2019-08-30 12:34:51 +01:00
|
|
|
// Copyright (C) 2019 Storj Labs, Inc.
|
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
2021-02-05 20:57:03 +00:00
|
|
|
import { Project, ProjectFields, ProjectLimits, ProjectsApi, ProjectsCursor, ProjectsPage } from '@/types/projects';
|
2019-08-30 12:34:51 +01:00
|
|
|
|
|
|
|
/**
|
2019-09-27 15:41:04 +01:00
|
|
|
* Mock for ProjectsApi
|
2019-08-30 12:34:51 +01:00
|
|
|
*/
|
|
|
|
export class ProjectsApiMock implements ProjectsApi {
|
2021-06-09 16:13:19 +01:00
|
|
|
private mockProjects: Project[] = [];
|
2019-12-12 16:25:38 +00:00
|
|
|
private mockLimits: ProjectLimits;
|
2021-02-05 20:57:03 +00:00
|
|
|
private mockProjectsPage: ProjectsPage;
|
2019-08-30 12:34:51 +01:00
|
|
|
|
2019-09-27 15:41:04 +01:00
|
|
|
public setMockProjects(mockProjects: Project[]): void {
|
|
|
|
this.mockProjects = mockProjects;
|
2019-08-30 12:34:51 +01:00
|
|
|
}
|
|
|
|
|
2019-12-12 16:25:38 +00:00
|
|
|
public setMockLimits(mockLimits: ProjectLimits): void {
|
|
|
|
this.mockLimits = mockLimits;
|
|
|
|
}
|
|
|
|
|
2021-08-05 12:07:45 +01:00
|
|
|
create(_createProjectFields: ProjectFields): Promise<Project> {
|
2019-08-30 12:34:51 +01:00
|
|
|
throw new Error('not implemented');
|
|
|
|
}
|
|
|
|
|
2021-08-05 12:07:45 +01:00
|
|
|
delete(_projectId: string): Promise<void> {
|
2019-08-30 12:34:51 +01:00
|
|
|
throw new Error('not implemented');
|
|
|
|
}
|
|
|
|
|
|
|
|
get(): Promise<Project[]> {
|
2019-09-27 15:41:04 +01:00
|
|
|
return Promise.resolve(this.mockProjects);
|
2019-08-30 12:34:51 +01:00
|
|
|
}
|
|
|
|
|
2021-08-05 12:07:45 +01:00
|
|
|
getOwnedProjects(_cursor: ProjectsCursor): Promise<ProjectsPage> {
|
2021-02-05 20:57:03 +00:00
|
|
|
return Promise.resolve(this.mockProjectsPage);
|
|
|
|
}
|
|
|
|
|
2021-08-05 12:07:45 +01:00
|
|
|
update(_projectId: string, _name: string, _description: string): Promise<void> {
|
2020-03-18 17:07:29 +00:00
|
|
|
return Promise.resolve();
|
2019-08-30 12:34:51 +01:00
|
|
|
}
|
2019-12-12 16:25:38 +00:00
|
|
|
|
2021-08-05 12:07:45 +01:00
|
|
|
getLimits(_projectId: string): Promise<ProjectLimits> {
|
2020-03-18 17:07:29 +00:00
|
|
|
return Promise.resolve(this.mockLimits);
|
2019-12-12 16:25:38 +00:00
|
|
|
}
|
2021-06-24 16:49:15 +01:00
|
|
|
|
|
|
|
getTotalLimits(): Promise<ProjectLimits> {
|
|
|
|
return Promise.resolve(this.mockLimits);
|
|
|
|
}
|
2019-08-30 12:34:51 +01:00
|
|
|
}
|