-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: simplify the AddContentContainer tests
- Loading branch information
1 parent
19fb9e2
commit 7fddc77
Showing
3 changed files
with
106 additions
and
93 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,40 @@ | ||
/* istanbul ignore file */ | ||
import * as api from './api'; | ||
|
||
/** | ||
* Mock for `getClipboard()` that simulates an empty clipboard | ||
*/ | ||
export async function mockClipboardEmpty(): Promise<api.ClipboardStatus> { | ||
return { | ||
content: null, | ||
sourceUsageKey: '', | ||
sourceContextTitle: '', | ||
sourceEditUrl: '', | ||
}; | ||
} | ||
mockClipboardEmpty.applyMock = () => jest.spyOn(api, 'getClipboard').mockImplementation(mockClipboardEmpty); | ||
mockClipboardEmpty.applyMockOnce = () => jest.spyOn(api, 'getClipboard').mockImplementationOnce(mockClipboardEmpty); | ||
|
||
/** | ||
* Mock for `getClipboard()` that simulates a copied HTML component | ||
*/ | ||
export async function mockClipboardHtml(): Promise<api.ClipboardStatus> { | ||
return { | ||
content: { | ||
id: 69, | ||
userId: 3, | ||
created: '2024-01-16T13:33:21.314439Z', | ||
purpose: 'clipboard', | ||
status: 'ready', | ||
blockType: 'html', | ||
blockTypeDisplay: 'Text', | ||
olxUrl: 'http://localhost:18010/api/content-staging/v1/staged-content/69/olx', | ||
displayName: 'Blank HTML Page', | ||
}, | ||
sourceUsageKey: 'block-v1:edX+DemoX+Demo_Course+type@html+block@html1', | ||
sourceContextTitle: 'Demonstration Course', | ||
sourceEditUrl: 'http://localhost:18010/container/block-v1:edX+DemoX+Demo_Course+type@vertical+block@vertical1', | ||
}; | ||
} | ||
mockClipboardHtml.applyMock = () => jest.spyOn(api, 'getClipboard').mockImplementation(mockClipboardHtml); | ||
mockClipboardHtml.applyMockOnce = () => jest.spyOn(api, 'getClipboard').mockImplementationOnce(mockClipboardHtml); |
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