JSFiddle - React, Tailwind, and code Playground
by LyndseyB
HTML
<script src="http://cdnjs.cloudflare.com/ajax/libs/mocha/1.13.0/mocha.min.js"></script>
http://sinonjs.org/
Babel + JSX
const Dictionary = () => {
let dictionary = [];
const create = () => {
let array = fs.readFileSync().toString().split('\r\n');
return array;
};
return {
init() {
if(dictionary.length) {
return dictionary;
}
return create();
}
};
};
describe('Dictionary' = () => {
describe('init()', () => {
it('should return an array');
it('should not return an empty array');
it('should create the dictionary only once', (done) => {
// use sinon to spy
// check that create is called only once
});
describe('create()', () => {
it('should add items to an array');
it('should return an array');
});
});
};
//export default dictionary();