storj/web/satellite/tests/unit/mock/api/accessGrants.ts
Egon Elbre 6b153192a3 web/satellite: fix lint issues
After migrating to eslint some errors were disabled to make it easier to
migrate.

This enables all the lint rules and treats all warnings as a build
failure. Similarly, CI won't automatically try to fix mistakes.

Change-Id: I80f808af026fc51bed90421b3b24737994a52094
2021-08-10 09:22:19 +00:00

43 lines
1.3 KiB
TypeScript

// Copyright (C) 2020 Storj Labs, Inc.
// See LICENSE for copying information.
import {
AccessGrant,
AccessGrantCursor,
AccessGrantsApi,
AccessGrantsPage,
GatewayCredentials,
} from '@/types/accessGrants';
/**
* Mock for AccessGrantsApi
*/
export class AccessGrantsMock implements AccessGrantsApi {
private readonly date = new Date(0);
private mockAccessGrantsPage: AccessGrantsPage;
public setMockAccessGrantsPage(mockAccessGrantsPage: AccessGrantsPage): void {
this.mockAccessGrantsPage = mockAccessGrantsPage;
}
get(_projectId: string, _cursor: AccessGrantCursor): Promise<AccessGrantsPage> {
return Promise.resolve(this.mockAccessGrantsPage);
}
create(_projectId: string, _name: string): Promise<AccessGrant> {
return Promise.resolve(new AccessGrant('testId', 'testName', this.date, 'testKey'));
}
delete(_ids: string[]): Promise<void> {
return Promise.resolve();
}
deleteByNameAndProjectID(_name: string, _projectID: string): Promise<void> {
return Promise.resolve();
}
getGatewayCredentials(_accessGrant: string, _optionalURL?: string): Promise<GatewayCredentials> {
return Promise.resolve(new GatewayCredentials('testCredId', new Date(), 'testAccessKeyId', 'testSecret', 'testEndpoint'));
}
}