Skip to content

Commit

Permalink
test: check method post
Browse files Browse the repository at this point in the history
  • Loading branch information
TiagoDanin committed Aug 29, 2019
1 parent bc7fe24 commit 9a97973
Show file tree
Hide file tree
Showing 4 changed files with 3,766 additions and 4 deletions.
11 changes: 8 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,12 +275,17 @@ class TelegrafTest {
}

startServer() {
this.server.get('/', (req, res) => {
const index = `
const index = `
Hello World!</br>
Web server of Telegraf Test by Tiago Danin</br>
https://github.com/TiagoDanin/Telegraf-Test
`
`

this.server.get('/', (req, res) => {
res.send(index)
})

this.server.post('/', (req, res) => {
res.send(index)
})

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"devDependencies": {
"mocha": "6.1.4",
"telegraf": "^3.30.1",
"xo": "0.24.0"
"xo": "^0.24.0"
},
"xo": {
"rules": {
Expand Down
5 changes: 5 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-disable no-undef */
const assert = require('assert')
const Telegraf = require('telegraf')
const axios = require('axios')
const TelegrafTest = require('.')

const port = 3000
Expand Down Expand Up @@ -182,4 +183,8 @@ describe('Telegraf Test', () => {
assert.strictEqual(r.data.method, 'answerCallbackQuery')
assert.strictEqual(r.data.text, 'Test‼️')
})

it('send request / via POST', async () => {
await axios.post('http://127.0.0.1:2000/')
})
})
Loading

0 comments on commit 9a97973

Please sign in to comment.