@transferwise/components 46.38.0 → 46.40.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.js +198 -461
- package/build/index.js.map +1 -1
- package/build/index.mjs +198 -461
- package/build/index.mjs.map +1 -1
- package/build/types/flowNavigation/backButton/BackButton.d.ts +5 -17
- package/build/types/flowNavigation/backButton/BackButton.d.ts.map +1 -1
- package/build/types/flowNavigation/backButton/index.d.ts +2 -2
- package/build/types/flowNavigation/backButton/index.d.ts.map +1 -1
- package/build/types/index.d.ts +3 -1
- package/build/types/index.d.ts.map +1 -1
- package/build/types/info/Info.d.ts +2 -2
- package/build/types/info/Info.d.ts.map +1 -1
- package/build/types/info/index.d.ts +1 -1
- package/build/types/info/index.d.ts.map +1 -1
- package/build/types/overlayHeader/OverlayHeader.d.ts +9 -18
- package/build/types/overlayHeader/OverlayHeader.d.ts.map +1 -1
- package/build/types/overlayHeader/index.d.ts +2 -1
- package/build/types/overlayHeader/index.d.ts.map +1 -1
- package/build/types/processIndicator/ProcessIndicator.d.ts +1 -1
- package/build/types/processIndicator/ProcessIndicator.d.ts.map +1 -1
- package/build/types/upload/Upload.d.ts +91 -55
- package/build/types/upload/Upload.d.ts.map +1 -1
- package/build/types/upload/Upload.messages.d.ts +42 -60
- package/build/types/upload/Upload.messages.d.ts.map +1 -1
- package/build/types/upload/index.d.ts +2 -2
- package/build/types/upload/index.d.ts.map +1 -1
- package/build/types/upload/steps/completeStep/completeStep.d.ts +11 -18
- package/build/types/upload/steps/completeStep/completeStep.d.ts.map +1 -1
- package/build/types/upload/steps/completeStep/index.d.ts +2 -1
- package/build/types/upload/steps/completeStep/index.d.ts.map +1 -1
- package/build/types/upload/steps/index.d.ts +3 -4
- package/build/types/upload/steps/index.d.ts.map +1 -1
- package/build/types/upload/steps/processingStep/index.d.ts +2 -1
- package/build/types/upload/steps/processingStep/index.d.ts.map +1 -1
- package/build/types/upload/steps/processingStep/processingStep.d.ts +11 -13
- package/build/types/upload/steps/processingStep/processingStep.d.ts.map +1 -1
- package/build/types/upload/steps/uploadImageStep/index.d.ts +2 -1
- package/build/types/upload/steps/uploadImageStep/index.d.ts.map +1 -1
- package/build/types/upload/steps/uploadImageStep/uploadImageStep.d.ts +14 -18
- package/build/types/upload/steps/uploadImageStep/uploadImageStep.d.ts.map +1 -1
- package/build/types/upload/utils/asyncFileRead/asyncFileRead.d.ts +1 -1
- package/build/types/upload/utils/asyncFileRead/asyncFileRead.d.ts.map +1 -1
- package/build/types/upload/utils/asyncFileRead/index.d.ts +1 -1
- package/build/types/upload/utils/asyncFileRead/index.d.ts.map +1 -1
- package/build/types/upload/utils/getFileType/getFileType.d.ts +1 -1
- package/build/types/upload/utils/getFileType/getFileType.d.ts.map +1 -1
- package/build/types/upload/utils/getFileType/index.d.ts +1 -1
- package/build/types/upload/utils/getFileType/index.d.ts.map +1 -1
- package/build/types/upload/utils/index.d.ts +5 -7
- package/build/types/upload/utils/index.d.ts.map +1 -1
- package/build/types/upload/utils/isSizeValid/index.d.ts +1 -1
- package/build/types/upload/utils/isSizeValid/index.d.ts.map +1 -1
- package/build/types/upload/utils/isSizeValid/isSizeValid.d.ts +1 -1
- package/build/types/upload/utils/isSizeValid/isSizeValid.d.ts.map +1 -1
- package/build/types/upload/utils/isTypeValid/index.d.ts +1 -1
- package/build/types/upload/utils/isTypeValid/index.d.ts.map +1 -1
- package/build/types/upload/utils/isTypeValid/isTypeValid.d.ts +1 -1
- package/build/types/upload/utils/isTypeValid/isTypeValid.d.ts.map +1 -1
- package/build/types/upload/utils/postData/index.d.ts +1 -1
- package/build/types/upload/utils/postData/index.d.ts.map +1 -1
- package/build/types/upload/utils/postData/postData.d.ts +11 -1
- package/build/types/upload/utils/postData/postData.d.ts.map +1 -1
- package/package.json +24 -26
- package/src/accordion/Accordion.spec.js +5 -5
- package/src/accordion/AccordionItem/AccordionItem.spec.js +2 -2
- package/src/actionButton/ActionButton.spec.tsx +4 -5
- package/src/alert/Alert.spec.tsx +4 -4
- package/src/alert/Alert.story.tsx +6 -5
- package/src/button/Button.spec.js +4 -5
- package/src/card/Card.spec.tsx +4 -4
- package/src/carousel/Carousel.spec.tsx +17 -17
- package/src/checkbox/Checkbox.spec.tsx +0 -2
- package/src/checkboxButton/CheckboxButton.spec.tsx +0 -2
- package/src/checkboxOption/CheckboxOption.spec.tsx +0 -2
- package/src/chevron/Chevron.spec.tsx +0 -1
- package/src/chips/Chips.spec.tsx +0 -1
- package/src/chips/Chips.story.tsx +5 -3
- package/src/circularButton/CircularButton.spec.tsx +4 -5
- package/src/common/RadioButton/RadioButton.spec.tsx +2 -2
- package/src/common/card/Card.story.tsx +1 -0
- package/src/common/closeButton/CloseButton.spec.tsx +0 -1
- package/src/common/flowHeader/FlowHeader.spec.tsx +0 -1
- package/src/dateInput/DateInput.story.tsx +21 -16
- package/src/dateLookup/DateLookup.rtl.spec.tsx +18 -16
- package/src/dateLookup/DateLookup.testingLibrary.spec.js +47 -44
- package/src/dateLookup/DateLookup.tests.story.tsx +4 -2
- package/src/decision/Decision.spec.js +0 -2
- package/src/dimmer/Dimmer.rtl.spec.js +10 -10
- package/src/drawer/Drawer.rtl.spec.tsx +2 -2
- package/src/emphasis/Emphasis.spec.tsx +0 -1
- package/src/field/Field.spec.tsx +2 -2
- package/src/flowNavigation/FlowNavigation.spec.js +0 -2
- package/src/flowNavigation/animatedLabel/AnimatedLabel.spec.js +0 -1
- package/src/flowNavigation/backButton/BackButton.tsx +29 -0
- package/src/flowNavigation/backButton/index.ts +2 -0
- package/src/header/Header.spec.tsx +6 -6
- package/src/image/Image.spec.tsx +0 -1
- package/src/index.ts +3 -1
- package/src/info/Info.story.tsx +15 -9
- package/src/info/Info.tsx +2 -2
- package/src/info/index.ts +1 -1
- package/src/inlineAlert/InlineAlert.spec.tsx +0 -1
- package/src/inputs/SelectInput.spec.tsx +26 -47
- package/src/link/Link.spec.tsx +0 -1
- package/src/listItem/ListItem.spec.tsx +0 -1
- package/src/moneyInput/MoneyInput.rtl.spec.tsx +2 -2
- package/src/moneyInput/MoneyInput.story.tsx +1 -4
- package/src/overlayHeader/{OverlayHeader.spec.js → OverlayHeader.spec.tsx} +1 -1
- package/src/overlayHeader/{OverlayHeader.story.js → OverlayHeader.story.tsx} +10 -2
- package/src/overlayHeader/{OverlayHeader.js → OverlayHeader.tsx} +12 -19
- package/src/overlayHeader/index.ts +2 -0
- package/src/phoneNumberInput/PhoneNumberInput.story.tsx +1 -0
- package/src/popover/Popover.spec.tsx +10 -10
- package/src/processIndicator/ProcessIndicator.tsx +1 -1
- package/src/progress/Progress.spec.tsx +0 -1
- package/src/progressBar/ProgressBar.spec.tsx +0 -1
- package/src/segmentedControl/SegmentedControl.spec.tsx +10 -11
- package/src/select/Select.spec.js +71 -71
- package/src/test-utils/index.js +1 -1
- package/src/test-utils/jest.setup.js +2 -0
- package/src/tooltip/Tooltip.spec.tsx +15 -16
- package/src/upload/Upload.spec.js +3 -14
- package/src/upload/Upload.story.tsx +37 -0
- package/src/upload/{Upload.js → Upload.tsx} +164 -169
- package/src/upload/index.ts +2 -0
- package/src/upload/steps/completeStep/completeStep.spec.js +3 -2
- package/src/upload/steps/completeStep/completeStep.tsx +74 -0
- package/src/upload/steps/completeStep/index.ts +2 -0
- package/src/upload/steps/{index.js → index.ts} +0 -1
- package/src/upload/steps/processingStep/index.ts +2 -0
- package/src/upload/steps/processingStep/processingStep.tsx +53 -0
- package/src/upload/steps/uploadImageStep/index.ts +2 -0
- package/src/upload/steps/uploadImageStep/{uploadImageStep.js → uploadImageStep.tsx} +17 -23
- package/src/upload/utils/asyncFileRead/asyncFileRead.spec.ts +14 -0
- package/src/upload/utils/asyncFileRead/asyncFileRead.ts +12 -0
- package/src/upload/utils/getFileType/getFileType.spec.ts +22 -0
- package/src/upload/utils/getFileType/getFileType.ts +16 -0
- package/src/upload/utils/{index.js → index.ts} +0 -2
- package/src/upload/utils/isSizeValid/{isSizeValid.spec.js → isSizeValid.spec.ts} +3 -3
- package/src/upload/utils/isSizeValid/isSizeValid.ts +3 -0
- package/src/upload/utils/isTypeValid/isTypeValid.spec.ts +62 -0
- package/src/upload/utils/isTypeValid/isTypeValid.ts +19 -0
- package/src/upload/utils/postData/postData.spec.ts +65 -0
- package/src/upload/utils/postData/postData.ts +36 -0
- package/src/uploadInput/UploadInput.spec.tsx +9 -10
- package/src/uploadInput/UploadInput.story.tsx +8 -180
- package/src/uploadInput/UploadInput.tests.story.tsx +212 -0
- package/src/uploadInput/UploadInput.tsx +1 -1
- package/src/uploadInput/uploadButton/UploadButton.spec.tsx +4 -4
- package/src/uploadInput/uploadItem/UploadItem.spec.tsx +4 -4
- package/build/types/upload/steps/mediaUploadStep/index.d.ts +0 -2
- package/build/types/upload/steps/mediaUploadStep/index.d.ts.map +0 -1
- package/build/types/upload/steps/mediaUploadStep/mediaUploadStep.d.ts +0 -24
- package/build/types/upload/steps/mediaUploadStep/mediaUploadStep.d.ts.map +0 -1
- package/build/types/upload/uploadSteps.d.ts +0 -5
- package/build/types/upload/uploadSteps.d.ts.map +0 -1
- package/build/types/upload/utils/getSupportedSpotMimeTypes/getSupportedSpotMimeTypes.d.ts +0 -2
- package/build/types/upload/utils/getSupportedSpotMimeTypes/getSupportedSpotMimeTypes.d.ts.map +0 -1
- package/build/types/upload/utils/getSupportedSpotMimeTypes/index.d.ts +0 -2
- package/build/types/upload/utils/getSupportedSpotMimeTypes/index.d.ts.map +0 -1
- package/build/types/upload/utils/requestMedia/index.d.ts +0 -2
- package/build/types/upload/utils/requestMedia/index.d.ts.map +0 -1
- package/build/types/upload/utils/requestMedia/requestMedia.d.ts +0 -2
- package/build/types/upload/utils/requestMedia/requestMedia.d.ts.map +0 -1
- package/src/flowNavigation/backButton/BackButton.js +0 -32
- package/src/flowNavigation/backButton/BackButton.spec.js +0 -16
- package/src/flowNavigation/backButton/__snapshots__/BackButton.spec.js.snap +0 -37
- package/src/flowNavigation/backButton/index.js +0 -3
- package/src/overlayHeader/index.js +0 -1
- package/src/upload/Upload.story.js +0 -36
- package/src/upload/index.js +0 -2
- package/src/upload/steps/completeStep/completeStep.js +0 -98
- package/src/upload/steps/completeStep/index.js +0 -1
- package/src/upload/steps/mediaUploadStep/index.js +0 -1
- package/src/upload/steps/mediaUploadStep/mediaUploadStep.js +0 -80
- package/src/upload/steps/mediaUploadStep/mediaUploadStep.spec.js +0 -77
- package/src/upload/steps/processingStep/index.js +0 -1
- package/src/upload/steps/processingStep/processingStep.js +0 -73
- package/src/upload/steps/uploadImageStep/index.js +0 -1
- package/src/upload/uploadSteps.ts +0 -5
- package/src/upload/utils/asyncFileRead/asyncFileRead.js +0 -11
- package/src/upload/utils/asyncFileRead/asyncFileRead.spec.js +0 -17
- package/src/upload/utils/getFileType/getFileType.js +0 -19
- package/src/upload/utils/getFileType/getFileType.spec.js +0 -33
- package/src/upload/utils/getSupportedSpotMimeTypes/getSupportedSpotMimeTypes.js +0 -18
- package/src/upload/utils/getSupportedSpotMimeTypes/getSupportedSpotMimeTypes.spec.js +0 -22
- package/src/upload/utils/getSupportedSpotMimeTypes/index.js +0 -1
- package/src/upload/utils/isSizeValid/isSizeValid.js +0 -1
- package/src/upload/utils/isTypeValid/isTypeValid.js +0 -26
- package/src/upload/utils/isTypeValid/isTypeValid.spec.js +0 -68
- package/src/upload/utils/postData/postData.js +0 -18
- package/src/upload/utils/postData/postData.spec.js +0 -109
- package/src/upload/utils/requestMedia/index.js +0 -1
- package/src/upload/utils/requestMedia/requestMedia.js +0 -26
- package/src/upload/utils/requestMedia/requestMedia.spec.js +0 -44
- /package/src/overlayHeader/__snapshots__/{OverlayHeader.spec.js.snap → OverlayHeader.spec.tsx.snap} +0 -0
- /package/src/upload/{Upload.messages.js → Upload.messages.ts} +0 -0
- /package/src/upload/utils/asyncFileRead/{index.js → index.ts} +0 -0
- /package/src/upload/utils/getFileType/{index.js → index.ts} +0 -0
- /package/src/upload/utils/isSizeValid/{index.js → index.ts} +0 -0
- /package/src/upload/utils/isTypeValid/{index.js → index.ts} +0 -0
- /package/src/upload/utils/postData/{index.js → index.ts} +0 -0
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { postData } from '.';
|
|
2
|
-
|
|
3
|
-
const HTTPOPTIONS = { url: 'a-url' };
|
|
4
|
-
const DATA = 'some-data';
|
|
5
|
-
|
|
6
|
-
describe('postData', () => {
|
|
7
|
-
afterEach(() => {
|
|
8
|
-
global.fetch.mockClear();
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
it('should work with resolve', async () => {
|
|
12
|
-
const RESOLVE_RESPONSE = { ok: true, someOtherStuff: 'someOtherStuff' };
|
|
13
|
-
jest.spyOn(global, 'fetch').mockImplementation(() => Promise.resolve(RESOLVE_RESPONSE));
|
|
14
|
-
|
|
15
|
-
expect.assertions(1);
|
|
16
|
-
|
|
17
|
-
await expect(postData(HTTPOPTIONS, DATA)).resolves.toStrictEqual(RESOLVE_RESPONSE);
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it('should throw when call fails', async () => {
|
|
21
|
-
const REJECT_RESPONSE = { status: '500', statusText: 'Rejected' };
|
|
22
|
-
jest.spyOn(global, 'fetch').mockImplementation(() => Promise.reject(REJECT_RESPONSE));
|
|
23
|
-
|
|
24
|
-
expect.assertions(1);
|
|
25
|
-
await expect(postData(HTTPOPTIONS, DATA)).rejects.toStrictEqual(REJECT_RESPONSE);
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it('should throw an Error when API returns an error code', async () => {
|
|
29
|
-
expect.assertions(1);
|
|
30
|
-
|
|
31
|
-
const ERROR_RESPONSE = { status: '500', statusText: 'Internal server error', ok: false };
|
|
32
|
-
jest.spyOn(global, 'fetch').mockImplementation(() => Promise.resolve(ERROR_RESPONSE));
|
|
33
|
-
|
|
34
|
-
await expect(postData(HTTPOPTIONS, DATA)).rejects.toStrictEqual(expect.any(Error));
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
it('should include the full response in the Error thrown', async () => {
|
|
38
|
-
expect.assertions(1);
|
|
39
|
-
|
|
40
|
-
const ERROR_RESPONSE = { status: '500', statusText: 'Internal server error', ok: false };
|
|
41
|
-
jest.spyOn(global, 'fetch').mockImplementation(() => Promise.resolve(ERROR_RESPONSE));
|
|
42
|
-
|
|
43
|
-
try {
|
|
44
|
-
await postData(HTTPOPTIONS, DATA);
|
|
45
|
-
} catch (error) {
|
|
46
|
-
expect(error.response).toStrictEqual(ERROR_RESPONSE);
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
it('should pass additional form data to request body', () => {
|
|
51
|
-
const data = { file: 'file', profileId: '1' };
|
|
52
|
-
const mockFetch = jest.fn(() => Promise.resolve({ ok: true }));
|
|
53
|
-
global.fetch = mockFetch;
|
|
54
|
-
|
|
55
|
-
postData(HTTPOPTIONS, data);
|
|
56
|
-
|
|
57
|
-
expect(mockFetch.mock.calls[0][1].body).toStrictEqual(data);
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
it('should override `Content-type` and add any custom headers to the request', () => {
|
|
61
|
-
const CUSTOM_CONTENT_TYPE = 'foo';
|
|
62
|
-
const CUSTOM_LANGUAGE = 'hu';
|
|
63
|
-
|
|
64
|
-
const mockFetch = jest.fn(() => Promise.resolve({ ok: true }));
|
|
65
|
-
global.fetch = mockFetch;
|
|
66
|
-
|
|
67
|
-
postData(
|
|
68
|
-
{
|
|
69
|
-
...HTTPOPTIONS,
|
|
70
|
-
headers: { 'Content-type': CUSTOM_CONTENT_TYPE, 'Accept-language': CUSTOM_LANGUAGE },
|
|
71
|
-
},
|
|
72
|
-
DATA,
|
|
73
|
-
);
|
|
74
|
-
|
|
75
|
-
expect(mockFetch.mock.calls[0][1].headers['Content-type']).toStrictEqual(CUSTOM_CONTENT_TYPE);
|
|
76
|
-
expect(mockFetch.mock.calls[0][1].headers['Accept-language']).toStrictEqual(CUSTOM_LANGUAGE);
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
it('should set method to `POST` by default', () => {
|
|
80
|
-
const mockFetch = jest.fn(() => Promise.resolve({ ok: true }));
|
|
81
|
-
global.fetch = mockFetch;
|
|
82
|
-
|
|
83
|
-
postData(HTTPOPTIONS, DATA);
|
|
84
|
-
|
|
85
|
-
expect(mockFetch.mock.calls[0][1].method).toStrictEqual('POST');
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
it('should not set `Content-type` by default', () => {
|
|
89
|
-
const mockFetch = jest.fn(() => Promise.resolve({ ok: true }));
|
|
90
|
-
global.fetch = mockFetch;
|
|
91
|
-
|
|
92
|
-
postData(HTTPOPTIONS, DATA);
|
|
93
|
-
|
|
94
|
-
expect(mockFetch.mock.calls[0][1]['Content-type']).toBeUndefined();
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
describe('when passed a fetcher as third argument', () => {
|
|
98
|
-
it('should call that instead of global.fetch', () => {
|
|
99
|
-
const RESOLVE_RESPONSE = new Response('', { status: 200 });
|
|
100
|
-
|
|
101
|
-
const fetcher = jest.fn(async () => RESOLVE_RESPONSE);
|
|
102
|
-
|
|
103
|
-
postData(HTTPOPTIONS, DATA, fetcher);
|
|
104
|
-
|
|
105
|
-
expect(global.fetch).not.toHaveBeenCalled();
|
|
106
|
-
expect(fetcher).toHaveBeenCalledTimes(1);
|
|
107
|
-
});
|
|
108
|
-
});
|
|
109
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { requestMedia } from './requestMedia';
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
export const requestMedia = (mediaRequest) =>
|
|
2
|
-
new Promise((resolve, reject) => {
|
|
3
|
-
if (typeof window === 'undefined' || typeof window.microapps === 'undefined') {
|
|
4
|
-
reject(`microapps must be available in window to use Spot Platform's Media API`);
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
window.microapps
|
|
8
|
-
.requestMedia(mediaRequest)
|
|
9
|
-
.then((response) => {
|
|
10
|
-
const fileByteArray = base64ToByteArray(response.bytes);
|
|
11
|
-
const blob = new Blob([fileByteArray], { type: response.mimeType });
|
|
12
|
-
resolve(blob);
|
|
13
|
-
})
|
|
14
|
-
.catch((error) => reject(error));
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
const base64ToByteArray = (base64String) => {
|
|
18
|
-
const byteCharacters = atob(base64String);
|
|
19
|
-
const byteCharactersLength = byteCharacters.length;
|
|
20
|
-
const byteArray = new Array(byteCharactersLength);
|
|
21
|
-
|
|
22
|
-
for (let i = 0; i < byteCharactersLength; i += 1) {
|
|
23
|
-
byteArray[i] = byteCharacters.charCodeAt(i);
|
|
24
|
-
}
|
|
25
|
-
return new Uint8Array(byteArray);
|
|
26
|
-
};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { requestMedia } from '.';
|
|
2
|
-
|
|
3
|
-
const mediaRequest = { allowedMimeTypes: ['images/jpeg'] };
|
|
4
|
-
|
|
5
|
-
describe('requestMedia', () => {
|
|
6
|
-
describe('when microapps is not available in windows', () => {
|
|
7
|
-
it('rejects with an error', () => {
|
|
8
|
-
expect.assertions(1);
|
|
9
|
-
return requestMedia(mediaRequest).catch((error) =>
|
|
10
|
-
expect(error).toStrictEqual(
|
|
11
|
-
`microapps must be available in window to use Spot Platform's Media API`,
|
|
12
|
-
),
|
|
13
|
-
);
|
|
14
|
-
});
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
describe('when microapps is available in windows', () => {
|
|
18
|
-
const originalMicroApps = window.microapps;
|
|
19
|
-
const image64 = {
|
|
20
|
-
bytes:
|
|
21
|
-
'iVBORw0KGgoAAAANSUhEUgAAAOEAAADhCAMAAAAJbSJIAAAAA1BMVEX/AAAZ4gk3AAAASElEQVR4nO3BgQAAAADDoPlTX+AIVQEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADwDcaiAAFXD1ujAAAAAElFTkSuQmCC',
|
|
22
|
-
mimeType: 'image/jpeg',
|
|
23
|
-
};
|
|
24
|
-
const microappsRequestMedia = jest.fn().mockImplementation(() => Promise.resolve(image64));
|
|
25
|
-
|
|
26
|
-
beforeAll(() => {
|
|
27
|
-
window.microapps = { requestMedia: microappsRequestMedia };
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
afterAll(() => {
|
|
31
|
-
window.microapps = originalMicroApps;
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
it(`calls microapps' requestMedia API when it's available in windows`, () => {
|
|
35
|
-
requestMedia(mediaRequest);
|
|
36
|
-
expect(microappsRequestMedia).toHaveBeenCalledWith(mediaRequest);
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
it('resolves with a blob file on success', () => {
|
|
40
|
-
expect.assertions(1);
|
|
41
|
-
return requestMedia(mediaRequest).then((file) => expect(file instanceof Blob).toBe(true));
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
});
|
/package/src/overlayHeader/__snapshots__/{OverlayHeader.spec.js.snap → OverlayHeader.spec.tsx.snap}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|