@code-o-mat/globals
Version:
Abstract Package to support CodeOMat series of apps.
64 lines (48 loc) • 1.53 kB
JavaScript
import Bunyan from 'bunyan';
const log = Bunyan.createLogger({name: "OMatTest"});
import 'mocha';
import { expect } from 'chai';
import * as FakeOMats from './test-objects';
const codePath
= process.env.NODE_ENV === "PRODUCTION"
? 'lib' : 'src';
const TYPES = require(`../${codePath}/constants/types`);
const {
O_MAT
} = TYPES;
const OMat = require(`../${codePath}/o-mat`).default;
describe(`test of basic OMat functions`,
() => {
var oMat;
var fakeOMat = new FakeOMats.OMat();
it(`should be able to create an OMat`,
() => {
oMat = new OMat();
expect(oMat.TYPE).to.equal(O_MAT);
expect(typeof oMat.uid).to.equal('function');
expect(typeof oMat.source).to.equal('function');
expect(typeof oMat.name).to.equal('function');
}
);
it(`should be able to get the uid from the OMat`,
() => {
expect(typeof oMat.uid()).to.equal('string');
}
);
it(`should be able to set a name for the OMat and retrieve it.`,
() => {
const stillOMat = oMat.name('Goody');
expect(stillOMat.uid()).to.equal(oMat.uid());
expect(stillOMat.name()).to.equal('Goody');
}
);
it(`should be able to set a source for the OMat and retrieve it.`,
() => {
log.info(typeof fakeOMat)
const stillOMat = oMat.source(fakeOMat);
expect(typeof stillOMat.source()).to.equal('object');
expect(stillOMat.source().TYPE).to.equal(O_MAT);
}
);
}
);