commit 8776e90114afc5ecfdfd151c3066b7e16f2b0548 parent d552baa58a9c28242f9b03d4fa8480ba4532f770 Author: Jared Tobin <jared@jtobin.io> Date: Wed, 7 Aug 2019 17:10:47 -0230 Add a simple API test. An innocent-looking change made in c8b0a8dc wound up borking the API in a way that was not detectable through the test suite. This just adds a test that confirms that the claimed exported functions are really exported. Diffstat:
A | test/api.test.js | | | 29 | +++++++++++++++++++++++++++++ |
1 file changed, 29 insertions(+), 0 deletions(-)
diff --git a/test/api.test.js b/test/api.test.js @@ -0,0 +1,29 @@ +const ob = require('../src') +const { expect } = require('chai') + +describe('the public-facing API', () => { + + const zod = '~zod' + const zoddec = '0' + const zodhex = '00' + const zodclan = 'galaxy' + + it('contains the appropriate exports', () => { + expect(ob.patp(zoddec)).to.equal(zod) + expect(ob.patp2hex(zod)).to.equal(zodhex) + expect(ob.hex2patp(zodhex)).to.equal(zod) + expect(ob.patp2dec(zod)).to.equal(zoddec) + expect(ob.sein(zod)).to.equal(zod) + expect(ob.clan(zod)).to.equal(zodclan) + + expect(ob.patq(zoddec)).to.equal(zod) + expect(ob.patq2hex(zod)).to.equal(zodhex) + expect(ob.hex2patq(zodhex)).to.equal(zod) + expect(ob.patq2dec(zod)).to.equal(zoddec) + + expect(ob.eqPatq(zod, zod)).to.equal(true) + expect(ob.isValidPatp(zod)).to.equal(true) + expect(ob.isValidPatq(zod)).to.equal(true) + }) +}) +