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 not override model prototype initialize method', async () => {
sinon.spy(ModelPrototype, 'initialize');
Model.forge();
ModelPrototype.initialize.callCount.should.equal(1);
sinon.restore(ModelPrototype);
});
it('attaches the photo', function () {
var spy = sinon.spy(Request.prototype, 'attach');
var req = new Subject(auth, 'fnord.png');
sinon.assert.calledOnce(spy);
sinon.assert.calledWith(spy, 'photo', 'fnord.png');
sinon.assert.calledOn(spy, req);
sinon.restore(spy);
});
afterEach(() => sinon.restore())
afterEach(() => {
sinon.restore();
});
"runner": {
"test": "http://localhost:3000"
}
}
`);
callback.onCall(1).resolves(template);
sinon.replace(fs, 'readFile', callback);
const target = '1.js';
sinon.replace(fs, 'appendFile', (fileTarget, str) => {
t.is(fileTarget, target);
t.is(str, expectResult);
});
await save(restAPIs, target);
sinon.restore();
});
ava('.setOptionByName() does not call EventBus.trigger() when #onChangeEventHandler() is null', (t) => {
EventBus.trigger = sinon.stub();
const optionValueMock = 'bow wow';
const optionNameMock = 'number';
const model = new GameOptions();
model.addOption(GAME_OPTION_LIST_MOCK[1]);
model.setOptionByName(optionNameMock, optionValueMock);
t.true(EventBus.trigger.callCount === 0);
EventBus.trigger = sinon.restore();
});
afterEach(() => {
sinon.restore();
});
it('is event emmitter', () => {
kernel.boot().then(() => {
const cliTransport = new CliTransport(kernel);
const container = kernel.getContainer();
const commander = container.get(CommandProvider);
sinon.stub(commander, 'output').callsFake((...args: any[]) => {
expect(args[0]).to.equal('Hello john');
done();
});
container.unbind(CommandProvider);
container.bind(CommandProvider).toConstantValue(commander);
cliTransport.up(['', '', 'hello', 'john']);
sinon.restore();
});
});
beforeEach(() => {
sinon.restore();
});
afterEach(function () {
sinon.restore()
})
})