UNPKG

@wmfs/j2119

Version:

A general-purpose validator generator that uses RFC2119-style assertions as input.

23 lines (17 loc) 631 B
/* eslint-env mocha */ const chai = require('chai') chai.use(require('dirty-chai')) const expect = chai.expect const condition = require('../lib/j2119/conditional') describe('J2119 RoleNotPresent Condition', () => { it('should fail on an excluded role', () => { const cut = condition.roleNotPresent(['foo', 'bar']) const json = { bar: 1 } expect(cut.constraintApplies(json, ['foo'])).to.be.false() }) it('should succeed on a non-excluded role', () => { const cut = condition.roleNotPresent(['foo', 'bar']) const json = { bar: 1 } expect(cut.constraintApplies(json, ['baz'])).to.be.true() }) })