-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CP-2931 added helper - mock-prebackup.ts, removed prebackup mock from…
… mock-descriptors, updated test to use the added helper instead of writing it in mockdescriptor or inside the test
- Loading branch information
1 parent
53c4923
commit 570d035
Showing
3 changed files
with
38 additions
and
30 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { E2EMockClient } from "../../../../libs/e2e-mock/client/src" | ||
|
||
// Helper function to mock PRE_BACKUP responses | ||
export function mockPreBackupResponses(path: string, backupId: number) { | ||
// Mock initial PRE_BACKUP response with status 202 (processing) | ||
E2EMockClient.mockResponse({ | ||
path, | ||
endpoint: "PRE_BACKUP", | ||
method: "POST", | ||
status: 202, | ||
body: { | ||
backupId, | ||
}, | ||
}) | ||
|
||
// After 10 seconds, update the response to status 200 (completed) | ||
setTimeout(() => { | ||
E2EMockClient.mockResponse({ | ||
path, | ||
endpoint: "PRE_BACKUP", | ||
method: "POST", | ||
status: 200, | ||
body: { | ||
backupId, | ||
features: { | ||
CONTACTS_V1: "path/to/backup/calls.json", | ||
CALL_LOGS_V1: "path/to/backup/call_logs.json", | ||
}, | ||
}, | ||
}) | ||
}, 10000) | ||
} |
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