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 auto create unless requested', done => {
const error = new ApiError('Error.');
error.code = 5;
database.getMetadata = callback => {
callback(error);
};
database.create = () => {
throw new Error('Should not create.');
};
database.get(err => {
assert.strictEqual(err, error);
done();
});
});
it('should not auto create unless requested', done => {
const error = new ApiError('Error.') as ServiceError;
error.code = 5;
sandbox
.stub(instance, 'getMetadata')
.callsFake(callback => callback!(error));
instance.create = () => {
throw new Error('Should not create.');
};
instance.get(err => {
assert.strictEqual(err, error);
done();
});
});