storj/web/satellite/tests/unit/mock/api/projects.ts
Vitalii Shpital ed28fa3ff9 web/satellite: added loaders across all the UI. Removed most of the requests from initial load
Added loader spinners across all of the UI to be visible while data is being fetched.
Removed most of the requests from the initial load of the satellite dashboard.
Removed useless requests after creating of new projects.
This should make user's experience much more better since load time of the app is much lower than it was before.

Change-Id: Ib0941ad4eee6b3caf781d132062b55cb17703fe7
2021-06-10 15:16:52 +00:00

46 lines
1.3 KiB
TypeScript

// Copyright (C) 2019 Storj Labs, Inc.
// See LICENSE for copying information.
import { Project, ProjectFields, ProjectLimits, ProjectsApi, ProjectsCursor, ProjectsPage } from '@/types/projects';
/**
* Mock for ProjectsApi
*/
export class ProjectsApiMock implements ProjectsApi {
private mockProjects: Project[] = [];
private mockLimits: ProjectLimits;
private mockProjectsPage: ProjectsPage;
public setMockProjects(mockProjects: Project[]): void {
this.mockProjects = mockProjects;
}
public setMockLimits(mockLimits: ProjectLimits): void {
this.mockLimits = mockLimits;
}
create(createProjectFields: ProjectFields): Promise<Project> {
throw new Error('not implemented');
}
delete(projectId: string): Promise<void> {
throw new Error('not implemented');
}
get(): Promise<Project[]> {
return Promise.resolve(this.mockProjects);
}
getOwnedProjects(cursor: ProjectsCursor): Promise<ProjectsPage> {
return Promise.resolve(this.mockProjectsPage);
}
update(projectId: string, name: string, description: string): Promise<void> {
return Promise.resolve();
}
getLimits(projectId: string): Promise<ProjectLimits> {
return Promise.resolve(this.mockLimits);
}
}