Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
aListOfTodos = [
aTodoWithId,
givenTodo({
id: 2,
title: 'do another thing',
}),
] as Todo[];
aTodoToPatchTo = givenTodo({
title: 'revised thing to do',
});
aChangedTodo = givenTodo({
id: aTodoWithId.id,
title: aTodoToPatchTo.title,
});
todos = sinon
.stub()
.withArgs(aTodoListWithId.id!)
.returns(constrainedTodoRepo);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(todoListRepo as any).todos = todos;
// Setup CRUD fakes
// eslint-disable-next-line @typescript-eslint/no-explicit-any
({create, find, patch, delete: del} = constrainedTodoRepo.stubs as any);
controller = new TodoListTodoController(todoListRepo);
}
});
function createStub() {
stub = sinon.stub(console, 'warn');
}
function createStub() {
stub = sinon.stub(console, 'warn');
}
});
function setupTestHelpers() {
app = new AppWithRepoMixin();
migrateStub = sinon.stub().resolves();
updateStub = sinon.stub().resolves();
DataSourceStub = class extends juggler.DataSource {
automigrate(models: string | string[]): Promise {
return migrateStub(models);
}
autoupdate(models: string | string[]): Promise {
return updateStub(models);
}
};
}
});
aTodoWithId = givenTodo({
id: 1,
});
aListOfTodos = [
aTodoWithId,
givenTodo({
id: 2,
title: 'so many things to do',
}),
] as Todo[];
aChangedTodo = givenTodo({
id: aTodoWithId.id,
title: 'Do some important things',
});
geoService = {geocode: sinon.stub()};
geocode = geoService.geocode as sinon.SinonStub;
controller = new TodoController(todoRepo, geoService);
}
});
export function createConsoleStub(): LogStub {
return sinon.stub(console, 'log');
}
function createStub() {
stub = sinon.stub(console, 'warn');
}
});