-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmainMenu.spec.js
More file actions
89 lines (83 loc) · 2.61 KB
/
Copy pathmainMenu.spec.js
File metadata and controls
89 lines (83 loc) · 2.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
let request
const host = process.env.HOST
beforeEach(() => {
jest.resetModules()
const { app } = require('./index')
const supertest = require('supertest')
request = supertest(app)
})
describe('POST /mainMenuPrompt', () => {
it('returns the percl commands for the main manu getdigits including redirect and prompt', async () => {
const res = await request.post('/mainMenuPrompt')
expect(res.status).toBe(200)
expect(res.body).toStrictEqual([
{
GetDigits: {
actionUrl: `${host}/mainMenu`,
flushBuffer: true,
maxDigits: 1,
minDigits: 1,
prompts: [
{
Say: {
loop: 1,
text:
' to make a one time payment please press 1, or press 0 to speak with an operator'
}
}
]
}
}
])
})
})
describe('POST /mainMenu', () => {
it('returns the percl command for redirect to /transfer when sent with digit "0" ', async () => {
const res = await request
.post('/mainMenu')
.type('form')
.send({ digits: '0' })
expect(res.status).toBe(200)
expect(res.body).toStrictEqual([
{
Redirect: {
actionUrl: `${host}/transfer`
}
}
])
})
it('returns the percl command for redirect to /ccAmount when sent with digit "1" ', async () => {
const res = await request
.post('/mainMenu')
.type('form')
.send({ digits: '1' })
expect(res.status).toBe(200)
expect(res.body).toStrictEqual([
{
Redirect: {
actionUrl: `${host}/ccAmountPrompt`
}
}
])
})
it('returns the percl command for redirect back to mainMenuPrompt when sent with invalid digits', async () => {
const res = await request
.post('/mainMenu')
.type('form')
.send({ digits: '7' })
expect(res.status).toBe(200)
expect(res.body).toStrictEqual([
{
Say: {
loop: 1,
text: 'Error, please try again'
}
},
{
Redirect: {
actionUrl: `${host}/mainMenuPrompt`
}
}
])
})
})