Skip to content

Commit

Permalink
schema coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
Ash committed Nov 30, 2023
1 parent 6ede5f9 commit 1762fac
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions test/getMessage.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
'use strict'

const joi = require('joi')
const Lab = require('@hapi/lab')
const lab = exports.lab = Lab.script()
const Code = require('@hapi/code')
const getMessage = require('../lib/functions/getMessage').getMessage
const getMessageEventSchema = require('../lib/helpers/schemas').getMessageEventSchema
const service = require('../lib/helpers/service')

let event
Expand Down Expand Up @@ -85,6 +87,10 @@ lab.experiment('getMessage', () => {
Code.expect(err.message).to.equal('test error')
})

lab.test('event schema', () => {
Code.expect(joi.isSchema(getMessageEventSchema)).to.equal(true)
})

lab.test('event validation test', async () => {
event.id = {}
await Code.expect(getMessage(event)).to.reject()
Expand Down
6 changes: 6 additions & 0 deletions test/processMessage.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
'use strict'

const joi = require('joi')
const Lab = require('@hapi/lab')
const lab = exports.lab = Lab.script()
const Code = require('@hapi/code')
const processMessage = require('../lib/functions/processMessage').processMessage
const processMessageEventSchema = require('../lib/helpers/schemas').processMessageEventSchema
const service = require('../lib/helpers/service')
const moment = require('moment')
let capAlert
Expand Down Expand Up @@ -278,4 +280,8 @@ lab.experiment('processMessage', () => {

await Code.expect(processMessage({ bodyXml: validBodyXml })).to.not.reject()
})

lab.test('event schema', () => {
Code.expect(joi.isSchema(processMessageEventSchema)).to.equal(true)
})
})

0 comments on commit 1762fac

Please sign in to comment.