Skip to content

Commit

Permalink
Add test for chatbot utilities
Browse files Browse the repository at this point in the history
  • Loading branch information
bkimminich committed Dec 21, 2020
1 parent d8a5ab1 commit 48760d4
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions test/server/botUtilsSpec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Copyright (c) 2014-2021 Bjoern Kimminich.
* SPDX-License-Identifier: MIT
*/

const chai = require('chai')
const expect = chai.expect
const insecurity = require('../../lib/insecurity')

describe('botUtils', () => {
const botUtils = require('../../lib/botUtils')

describe('testFunction', () => {
it('returns static test response', () => {
expect(botUtils.testFunction()).to.deep.equal({
action: 'response',
body: '3be2e438b7f3d04c89d7749f727bb3bd'
})
})
})

describe('couponCode', () => {
it('response contains a valid 10% coupon code for current date', () => {
expect(botUtils.couponCode()).to.deep.equal({
action: 'response',
body: `Oooookay, if you promise to stop nagging me here's a 10% coupon code for you: ${insecurity.generateCoupon(10, new Date())}`
})
})
})
})

0 comments on commit 48760d4

Please sign in to comment.