storj/web/satellite/tests/unit/mock/api/users.ts
Wilfred Asomani 6857a48a0b web/satellite: change onboarding trigger
This change uses the onboarding user settings for whether to show
 onboarding (pricing plan) or not.
This change also fixes an issue where a new user is prompted for
passphrase once from onboarding and a second time on the dashboard.

Issue: https://github.com/storj/storj/issues/5661
https://github.com/storj/storj/issues/5675

Change-Id: I8e92c732260116de830cfbbbe0545f7e7c8997b0
2023-03-28 08:47:13 +00:00

52 lines
1.3 KiB
TypeScript

// Copyright (C) 2019 Storj Labs, Inc.
// See LICENSE for copying information.
import { UpdatedUser, User, UsersApi, UserSettings } from '@/types/users';
/**
* Mock for UsersApi
*/
export class UsersApiMock implements UsersApi {
private mockUser: User;
public setMockUser(mockUser: User): void {
this.mockUser = mockUser;
}
public get(): Promise<User> {
return Promise.resolve(this.mockUser);
}
public getFrozenStatus(): Promise<boolean> {
return Promise.resolve(true);
}
public getUserSettings(): Promise<UserSettings> {
return Promise.resolve(new UserSettings());
}
public setOnboardingStatus(status: Partial<UserSettings>): Promise<void> {
return Promise.resolve();
}
public update(_user: UpdatedUser): Promise<void> {
throw new Error('not implemented');
}
public enableUserMFA(_: string): Promise<void> {
return Promise.resolve();
}
public disableUserMFA(_passcode: string, _recoveryCode: string): Promise<void> {
return Promise.resolve();
}
public generateUserMFASecret(): Promise<string> {
return Promise.resolve('test');
}
public generateUserMFARecoveryCodes(): Promise<string[]> {
return Promise.resolve(['test', 'test1', 'test2']);
}
}