-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4315 from beyondessential/release-2023-04
Release 2023 04
- Loading branch information
Showing
62 changed files
with
4,332 additions
and
375 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/** | ||
* Tupaia | ||
* Copyright (c) 2017 - 2022 Beyond Essential Systems Pty Ltd | ||
*/ | ||
|
||
import { | ||
AuthApiInterface, | ||
CentralApiInterface, | ||
EntityApiInterface, | ||
ReportApiInterface, | ||
} from './connections'; | ||
|
||
import { MockAuthApi, MockCentralApi, MockEntityApi, MockReportApi } from './connections/mocks'; | ||
|
||
export class MockTupaiaApiClient { | ||
public readonly entity: EntityApiInterface; | ||
public readonly central: CentralApiInterface; | ||
public readonly auth: AuthApiInterface; | ||
public readonly report: ReportApiInterface; | ||
|
||
public constructor({ | ||
auth = new MockAuthApi(), | ||
central = new MockCentralApi(), | ||
entity = new MockEntityApi(), | ||
report = new MockReportApi(), | ||
}) { | ||
this.auth = auth; | ||
this.central = central; | ||
this.entity = entity; | ||
this.report = report; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* eslint-disable @typescript-eslint/no-unused-vars */ | ||
/** | ||
* Tupaia | ||
* Copyright (c) 2017 - 2022 Beyond Essential Systems Pty Ltd | ||
*/ | ||
|
||
import { AuthApiInterface } from '..'; | ||
import { AccessPolicyObject } from '../../types'; | ||
|
||
export class MockAuthApi implements AuthApiInterface { | ||
public login(authDetails: { | ||
emailAddress: string; | ||
password: string; | ||
deviceName: string; | ||
devicePlatform?: string | undefined; | ||
installId?: string | undefined; | ||
}): Promise<{ | ||
accessToken: string; | ||
refreshToken: string; | ||
accessPolicy: AccessPolicyObject; | ||
email: string; | ||
user: { email: string; accessPolicy: AccessPolicyObject }; | ||
}> { | ||
throw new Error('Method not implemented.'); | ||
} | ||
public refreshAccessToken( | ||
refreshToken: string, | ||
): Promise<{ | ||
accessToken: string; | ||
refreshToken: string; | ||
accessPolicy: AccessPolicyObject; | ||
email: string; | ||
user: { email: string; accessPolicy: AccessPolicyObject }; | ||
}> { | ||
throw new Error('Method not implemented.'); | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
packages/api-client/src/connections/mocks/MockCentralApi.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* eslint-disable @typescript-eslint/no-unused-vars */ | ||
/** | ||
* Tupaia | ||
* Copyright (c) 2017 - 2022 Beyond Essential Systems Pty Ltd | ||
*/ | ||
|
||
import { CentralApiInterface } from '..'; | ||
import { RequestBody } from '../ApiConnection'; | ||
import { SurveyResponse } from '../CentralApi'; | ||
|
||
export class MockCentralApi implements CentralApiInterface { | ||
public getUser(): Promise<any> { | ||
throw new Error('Method not implemented.'); | ||
} | ||
public registerUserAccount( | ||
userFields: Record<string, unknown>, | ||
): Promise<{ userId: string; message: string }> { | ||
throw new Error('Method not implemented.'); | ||
} | ||
public changeUserPassword( | ||
passwordChangeFields: Record<string, unknown>, | ||
): Promise<{ message: string }> { | ||
throw new Error('Method not implemented.'); | ||
} | ||
public createSurveyResponses(responses: SurveyResponse[]): Promise<void> { | ||
throw new Error('Method not implemented.'); | ||
} | ||
public fetchResources( | ||
endpoint: string, | ||
params?: Record<string, unknown> | undefined, | ||
): Promise<any> { | ||
throw new Error('Method not implemented.'); | ||
} | ||
public createResource( | ||
endpoint: string, | ||
params: Record<string, unknown>, | ||
body: RequestBody, | ||
): Promise<any> { | ||
throw new Error('Method not implemented.'); | ||
} | ||
public updateResource( | ||
endpoint: string, | ||
params: Record<string, unknown>, | ||
body: RequestBody, | ||
): Promise<any> { | ||
throw new Error('Method not implemented.'); | ||
} | ||
public deleteResource(endpoint: string): Promise<any> { | ||
throw new Error('Method not implemented.'); | ||
} | ||
public upsertResource( | ||
endpoint: string, | ||
params: Record<string, unknown>, | ||
body: RequestBody, | ||
): Promise<any> { | ||
throw new Error('Method not implemented.'); | ||
} | ||
} |
Oops, something went wrong.