-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathccConfirmationMessage.spec.js
More file actions
53 lines (49 loc) · 1.52 KB
/
Copy pathccConfirmationMessage.spec.js
File metadata and controls
53 lines (49 loc) · 1.52 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
let request
const host = process.env.HOST
const fcNumber = process.env.FC_NUMBER
const OLD_ENV = process.env
beforeEach(() => {
jest.resetModules()
const { app } = require('./index')
process.env = { ...OLD_ENV, FC_NUMBER: '+11234567890' }
const supertest = require('supertest')
const confirmationCode = require('./confirmationCode')
jest.spyOn(confirmationCode, 'generate').mockImplementation(() => {
return 111111
})
request = supertest(app)
})
afterAll(() => {
process.env = OLD_ENV
})
describe('POST /ccConfirmationMessage', () => {
it('returns percl commands for sms confirmation message', async () => {
const res = await request
.post('/ccConfirmationMessage')
.type('form')
.send({ from: '1' })
expect(res.status).toBe(200)
expect(res.body).toStrictEqual([
{
Say: {
loop: 1,
text:
'Thank you for your payment, your confirmation number is 111111, you will receive an sms shortly'
}
},
{
Sms: {
from: `${process.env.FC_NUMBER}`,
text:
'your confirmation number is 111111, thank you for using the Node pay-by-phone tutorial',
to: '1'
}
},
{
Redirect: {
actionUrl: `${host}/endcall`
}
}
])
})
})