6-mils
Version:
A JS library for sending, receiving, and parsing cXML messages.
44 lines (37 loc) • 1.2 kB
JavaScript
/* eslint-env mocha */
/**
* Code under test.
* @type {any}
*/
const T = require('./index.js')
describe('the "CxmlPayloadId" module', function () {
it('must export a function', function () {
const expected = 'function'
const actual = typeof T
expect(actual).to.equal(expected)
})
describe('the exported function', function () {
it('must return a string value', function () {
const expected = 'string'
const actual = typeof T()
expect(actual).to.equal(expected)
})
describe('the string value', function () {
it('must conform to the suggested implementation', function () {
const expected = /^\d+\.\d+\.\w+@/
const actual = T()
expect(actual).to.match(expected)
})
it('must end in "@6-mils" if no hostname is specified', function () {
const expected = /^\d+\.\d+\.\w+@6-mils$/
const actual = T()
expect(actual).to.match(expected)
})
it('must end in the specified hostname (if provided)', function () {
const expected = /^\d+\.\d+\.\w+@example\.com$/
const actual = T('@example.com')
expect(actual).to.match(expected)
})
})
})
})