Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('should add a spec loader', async () => {
let called = 0;
let loaded = 0;
Mode.addSpecLoader(async spec => {
called++;
if (spec.mode !== 'bar') {
return false;
}
loaded++;
return true;
}, 42);
CodeMirror.modeInfo.push(fakeMode('bar'));
let spec = await Mode.ensure('bar');
expect(called).to.equal(1);
expect(loaded).to.equal(1);
expect(spec!.name).to.equal('BAR');
spec = await Mode.ensure('python');