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 call function", () => {
const serviceName = "svc1";
const routes = new StitchServiceRoutes("foo");
const requestClientMock = mock(CoreStitchAuth);
when(
requestClientMock.doAuthenticatedRequestWithDecoder(
anyOfClass(StitchAuthRequest),
anything()
)
).thenReturn(Promise.resolve(42));
const requestClient: StitchAuthRequestClient = instance(requestClientMock);
const coreStitchService = new CoreStitchServiceClientImpl(
requestClient,
routes,
serviceName
);
const funcName = "myFunc1";
const args = [1, 2, 3];
const expectedRequestDoc = {
arguments: args,
const spiedBinder1 = spy(binder1);
const spiedBinder2 = spy(binder2);
underTest.bind(binder1);
underTest.bind(binder2);
const event = new AuthRebindEvent({
currentActiveUser: undefined,
kind: AuthEventKind.ActiveUserChanged,
previousActiveUser: undefined,
});
underTest.onRebindEvent(event);
verify(spiedBinder2.onRebindEvent(anyOfClass(AuthRebindEvent))).called();
verify(spiedBinder1.onRebindEvent(anyOfClass(AuthRebindEvent))).called();
});
before() {
const connection = mock(Connection);
Query.connection = instance(connection);
when(connection.get(anyOfClass(Query))).thenCall((query: Query) => {
return query.toSql();
});
this.query = new Query;
}
async selectsEverything() {
when(this.connection.get(anyOfClass(Query))).thenReturn(Promise.resolve(Object.values(this.data)));
const users = await User.get();
this.expectToContain(users[0], this.data.user1);
}