@atlaskit/media-test-helpers 37.0.4 → 38.0.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/CHANGELOG.md +8 -0
- package/dist/cjs/authProvider.js +6 -0
- package/dist/cjs/clipboardEventMocks.js +1 -0
- package/dist/es2019/authProvider.js +6 -0
- package/dist/es2019/clipboardEventMocks.js +1 -0
- package/dist/esm/authProvider.js +6 -0
- package/dist/esm/clipboardEventMocks.js +1 -0
- package/dist/types/clipboardEventMocks.d.ts +5 -5
- package/dist/types/fileStateFactory/factory/helpers.d.ts +2 -2
- package/dist/types/getJest.d.ts +0 -1
- package/dist/types/jestHelpers.d.ts +0 -1
- package/dist/types/mockCanvas.d.ts +0 -1
- package/dist/types/mountWithIntlContext.d.ts +3 -3
- package/dist/types/story-styles.d.ts +2 -3
- package/dist/types-ts4.5/clipboardEventMocks.d.ts +5 -5
- package/dist/types-ts4.5/fileStateFactory/factory/helpers.d.ts +2 -2
- package/dist/types-ts4.5/getJest.d.ts +0 -1
- package/dist/types-ts4.5/jestHelpers.d.ts +0 -1
- package/dist/types-ts4.5/mockCanvas.d.ts +0 -1
- package/dist/types-ts4.5/mountWithIntlContext.d.ts +3 -3
- package/dist/types-ts4.5/story-styles.d.ts +2 -3
- package/package.json +4 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/media-test-helpers
|
|
2
2
|
|
|
3
|
+
## 38.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [#201150](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/201150)
|
|
8
|
+
[`f47383d54270a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f47383d54270a) -
|
|
9
|
+
Prevent staging environment auth provider from being consumed inside of unit tests
|
|
10
|
+
|
|
3
11
|
## 37.0.4
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
package/dist/cjs/authProvider.js
CHANGED
|
@@ -58,6 +58,12 @@ var StoryBookAuthProvider = exports.StoryBookAuthProvider = /*#__PURE__*/functio
|
|
|
58
58
|
};
|
|
59
59
|
}();
|
|
60
60
|
return function (authContext) {
|
|
61
|
+
var IS_UNIT_TEST = process.env.JEST_WORKER_ID !== undefined;
|
|
62
|
+
if (IS_UNIT_TEST) {
|
|
63
|
+
// This is to prevent accidental staging environment calls from the auth provider in unit tests
|
|
64
|
+
// The implementation also means that it can effect unrelated tests due to the setInterval and unhandled promise rejection
|
|
65
|
+
throw new Error('Unexpected call to auth provider, please mock the auth provider in your test');
|
|
66
|
+
}
|
|
61
67
|
var collectionName = authContext && authContext.collectionName || _collectionNames.defaultCollectionName;
|
|
62
68
|
var accessStr = access ? JSON.stringify(access) : '';
|
|
63
69
|
var cacheKey = "".concat(collectionName, "-").concat(accessStr, "-").concat(isAsapEnvironment);
|
|
@@ -18,6 +18,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
18
18
|
// see https://github.com/tmpvar/jsdom/issues/1568
|
|
19
19
|
// TODO: remove this `Omit` usage once TS fixes File class regression.
|
|
20
20
|
// https://github.com/microsoft/TypeScript/issues/52166
|
|
21
|
+
// @ts-ignore - TS2420 TypeScript 5.9.2 upgrade
|
|
21
22
|
var ClipboardMockFile = exports.ClipboardMockFile = /*#__PURE__*/function () {
|
|
22
23
|
function ClipboardMockFile() {
|
|
23
24
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
|
|
@@ -23,6 +23,12 @@ export class StoryBookAuthProvider {
|
|
|
23
23
|
return await (await response).json();
|
|
24
24
|
};
|
|
25
25
|
return authContext => {
|
|
26
|
+
const IS_UNIT_TEST = process.env.JEST_WORKER_ID !== undefined;
|
|
27
|
+
if (IS_UNIT_TEST) {
|
|
28
|
+
// This is to prevent accidental staging environment calls from the auth provider in unit tests
|
|
29
|
+
// The implementation also means that it can effect unrelated tests due to the setInterval and unhandled promise rejection
|
|
30
|
+
throw new Error('Unexpected call to auth provider, please mock the auth provider in your test');
|
|
31
|
+
}
|
|
26
32
|
const collectionName = authContext && authContext.collectionName || defaultCollectionName;
|
|
27
33
|
const accessStr = access ? JSON.stringify(access) : '';
|
|
28
34
|
const cacheKey = `${collectionName}-${accessStr}-${isAsapEnvironment}`;
|
|
@@ -3,6 +3,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
3
3
|
// see https://github.com/tmpvar/jsdom/issues/1568
|
|
4
4
|
// TODO: remove this `Omit` usage once TS fixes File class regression.
|
|
5
5
|
// https://github.com/microsoft/TypeScript/issues/52166
|
|
6
|
+
// @ts-ignore - TS2420 TypeScript 5.9.2 upgrade
|
|
6
7
|
export class ClipboardMockFile {
|
|
7
8
|
msClose() {}
|
|
8
9
|
msDetachStream() {}
|
package/dist/esm/authProvider.js
CHANGED
|
@@ -51,6 +51,12 @@ export var StoryBookAuthProvider = /*#__PURE__*/function () {
|
|
|
51
51
|
};
|
|
52
52
|
}();
|
|
53
53
|
return function (authContext) {
|
|
54
|
+
var IS_UNIT_TEST = process.env.JEST_WORKER_ID !== undefined;
|
|
55
|
+
if (IS_UNIT_TEST) {
|
|
56
|
+
// This is to prevent accidental staging environment calls from the auth provider in unit tests
|
|
57
|
+
// The implementation also means that it can effect unrelated tests due to the setInterval and unhandled promise rejection
|
|
58
|
+
throw new Error('Unexpected call to auth provider, please mock the auth provider in your test');
|
|
59
|
+
}
|
|
54
60
|
var collectionName = authContext && authContext.collectionName || defaultCollectionName;
|
|
55
61
|
var accessStr = access ? JSON.stringify(access) : '';
|
|
56
62
|
var cacheKey = "".concat(collectionName, "-").concat(accessStr, "-").concat(isAsapEnvironment);
|
|
@@ -11,6 +11,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
11
11
|
// see https://github.com/tmpvar/jsdom/issues/1568
|
|
12
12
|
// TODO: remove this `Omit` usage once TS fixes File class regression.
|
|
13
13
|
// https://github.com/microsoft/TypeScript/issues/52166
|
|
14
|
+
// @ts-ignore - TS2420 TypeScript 5.9.2 upgrade
|
|
14
15
|
export var ClipboardMockFile = /*#__PURE__*/function () {
|
|
15
16
|
function ClipboardMockFile() {
|
|
16
17
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
|
|
@@ -47,10 +47,10 @@ export declare const getMockClipboardEvent: () => {
|
|
|
47
47
|
returnValue: boolean;
|
|
48
48
|
readonly srcElement: EventTarget | null;
|
|
49
49
|
readonly target: EventTarget | null;
|
|
50
|
-
readonly timeStamp:
|
|
50
|
+
readonly timeStamp: DOMHighResTimeStamp;
|
|
51
51
|
readonly type: string;
|
|
52
52
|
composedPath(): EventTarget[];
|
|
53
|
-
initEvent(type: string, bubbles?: boolean
|
|
53
|
+
initEvent(type: string, bubbles?: boolean, cancelable?: boolean): void;
|
|
54
54
|
preventDefault(): void;
|
|
55
55
|
stopImmediatePropagation(): void;
|
|
56
56
|
stopPropagation(): void;
|
|
@@ -95,7 +95,7 @@ export declare const MockDragEvent: () => {
|
|
|
95
95
|
readonly detail: number;
|
|
96
96
|
readonly view: Window | null;
|
|
97
97
|
readonly which: number;
|
|
98
|
-
initUIEvent(typeArg: string, bubblesArg?: boolean
|
|
98
|
+
initUIEvent(typeArg: string, bubblesArg?: boolean, cancelableArg?: boolean, viewArg?: Window | null, detailArg?: number): void;
|
|
99
99
|
readonly bubbles: boolean;
|
|
100
100
|
cancelBubble: boolean;
|
|
101
101
|
readonly cancelable: boolean;
|
|
@@ -107,10 +107,10 @@ export declare const MockDragEvent: () => {
|
|
|
107
107
|
returnValue: boolean;
|
|
108
108
|
readonly srcElement: EventTarget | null;
|
|
109
109
|
readonly target: EventTarget | null;
|
|
110
|
-
readonly timeStamp:
|
|
110
|
+
readonly timeStamp: DOMHighResTimeStamp;
|
|
111
111
|
readonly type: string;
|
|
112
112
|
composedPath(): EventTarget[];
|
|
113
|
-
initEvent(type: string, bubbles?: boolean
|
|
113
|
+
initEvent(type: string, bubbles?: boolean, cancelable?: boolean): void;
|
|
114
114
|
preventDefault(): void;
|
|
115
115
|
stopImmediatePropagation(): void;
|
|
116
116
|
stopPropagation(): void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type FileIdentifier, type FileDetails, type MediaType } from '@atlaskit/media-client';
|
|
2
2
|
export declare const defaultFileDetails: Partial<FileDetails>;
|
|
3
3
|
export declare const createIdentifier: ({ collectionName, occurrenceKey, }?: {
|
|
4
|
-
occurrenceKey?: string
|
|
5
|
-
collectionName?: string
|
|
4
|
+
occurrenceKey?: string;
|
|
5
|
+
collectionName?: string;
|
|
6
6
|
}) => FileIdentifier;
|
|
7
7
|
export declare const createFileDetails: (id: string, mediaType?: MediaType) => FileDetails;
|
package/dist/types/getJest.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="jest" />
|
|
2
1
|
export declare const asMock: (fn: Function) => jest.Mock;
|
|
3
2
|
export declare const asMockFunction: <T extends (...args: any[]) => any>(fn: T) => jest.MockedFunction<T>;
|
|
4
3
|
export declare const asMockReturnValue: <T extends (...args: any[]) => any>(fn: T, returnValue: ReturnType<T>) => jest.Mock<any, any, any>;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type WrappedComponentProps } from 'react-intl-next';
|
|
3
3
|
import { type ReactWrapper, type ShallowWrapper } from 'enzyme';
|
|
4
|
-
import { type ReactElement } from 'react';
|
|
5
|
-
export declare const mountWithIntlContext: <P, S, C extends
|
|
4
|
+
import { type Component, type ReactElement } from 'react';
|
|
5
|
+
export declare const mountWithIntlContext: <P, S, C extends Component<P, S> = Component<P, S>>(node: ReactElement<P & WrappedComponentProps>, { context, childContextTypes, ...additionalOptions }?: {
|
|
6
6
|
context?: {} | undefined;
|
|
7
7
|
childContextTypes?: {} | undefined;
|
|
8
8
|
}) => ReactWrapper<P & WrappedComponentProps, S, C>;
|
|
9
|
-
export declare const shallowWithIntlContext: <P, S, C extends
|
|
9
|
+
export declare const shallowWithIntlContext: <P, S, C extends Component<P, S> = Component<P, S>>(node: ReactElement<P & WrappedComponentProps>, { context, ...additionalOptions }?: {
|
|
10
10
|
context?: {} | undefined;
|
|
11
11
|
}) => ShallowWrapper<P & WrappedComponentProps, S, C>;
|
|
12
12
|
export declare const mountWithIntlWrapper: (node: React.ReactElement) => ReactWrapper;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
export declare const Matrix: import("@emotion/styled").StyledComponent<{
|
|
3
|
-
theme?: import("@emotion/react").Theme
|
|
4
|
-
as?:
|
|
2
|
+
theme?: import("@emotion/react").Theme;
|
|
3
|
+
as?: React.ElementType;
|
|
5
4
|
}, import("react").DetailedHTMLProps<import("react").TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>, {}>;
|
|
@@ -47,10 +47,10 @@ export declare const getMockClipboardEvent: () => {
|
|
|
47
47
|
returnValue: boolean;
|
|
48
48
|
readonly srcElement: EventTarget | null;
|
|
49
49
|
readonly target: EventTarget | null;
|
|
50
|
-
readonly timeStamp:
|
|
50
|
+
readonly timeStamp: DOMHighResTimeStamp;
|
|
51
51
|
readonly type: string;
|
|
52
52
|
composedPath(): EventTarget[];
|
|
53
|
-
initEvent(type: string, bubbles?: boolean
|
|
53
|
+
initEvent(type: string, bubbles?: boolean, cancelable?: boolean): void;
|
|
54
54
|
preventDefault(): void;
|
|
55
55
|
stopImmediatePropagation(): void;
|
|
56
56
|
stopPropagation(): void;
|
|
@@ -95,7 +95,7 @@ export declare const MockDragEvent: () => {
|
|
|
95
95
|
readonly detail: number;
|
|
96
96
|
readonly view: Window | null;
|
|
97
97
|
readonly which: number;
|
|
98
|
-
initUIEvent(typeArg: string, bubblesArg?: boolean
|
|
98
|
+
initUIEvent(typeArg: string, bubblesArg?: boolean, cancelableArg?: boolean, viewArg?: Window | null, detailArg?: number): void;
|
|
99
99
|
readonly bubbles: boolean;
|
|
100
100
|
cancelBubble: boolean;
|
|
101
101
|
readonly cancelable: boolean;
|
|
@@ -107,10 +107,10 @@ export declare const MockDragEvent: () => {
|
|
|
107
107
|
returnValue: boolean;
|
|
108
108
|
readonly srcElement: EventTarget | null;
|
|
109
109
|
readonly target: EventTarget | null;
|
|
110
|
-
readonly timeStamp:
|
|
110
|
+
readonly timeStamp: DOMHighResTimeStamp;
|
|
111
111
|
readonly type: string;
|
|
112
112
|
composedPath(): EventTarget[];
|
|
113
|
-
initEvent(type: string, bubbles?: boolean
|
|
113
|
+
initEvent(type: string, bubbles?: boolean, cancelable?: boolean): void;
|
|
114
114
|
preventDefault(): void;
|
|
115
115
|
stopImmediatePropagation(): void;
|
|
116
116
|
stopPropagation(): void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type FileIdentifier, type FileDetails, type MediaType } from '@atlaskit/media-client';
|
|
2
2
|
export declare const defaultFileDetails: Partial<FileDetails>;
|
|
3
3
|
export declare const createIdentifier: ({ collectionName, occurrenceKey, }?: {
|
|
4
|
-
occurrenceKey?: string
|
|
5
|
-
collectionName?: string
|
|
4
|
+
occurrenceKey?: string;
|
|
5
|
+
collectionName?: string;
|
|
6
6
|
}) => FileIdentifier;
|
|
7
7
|
export declare const createFileDetails: (id: string, mediaType?: MediaType) => FileDetails;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="jest" />
|
|
2
1
|
export declare const asMock: (fn: Function) => jest.Mock;
|
|
3
2
|
export declare const asMockFunction: <T extends (...args: any[]) => any>(fn: T) => jest.MockedFunction<T>;
|
|
4
3
|
export declare const asMockReturnValue: <T extends (...args: any[]) => any>(fn: T, returnValue: ReturnType<T>) => jest.Mock<any, any, any>;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type WrappedComponentProps } from 'react-intl-next';
|
|
3
3
|
import { type ReactWrapper, type ShallowWrapper } from 'enzyme';
|
|
4
|
-
import { type ReactElement } from 'react';
|
|
5
|
-
export declare const mountWithIntlContext: <P, S, C extends
|
|
4
|
+
import { type Component, type ReactElement } from 'react';
|
|
5
|
+
export declare const mountWithIntlContext: <P, S, C extends Component<P, S> = Component<P, S>>(node: ReactElement<P & WrappedComponentProps>, { context, childContextTypes, ...additionalOptions }?: {
|
|
6
6
|
context?: {} | undefined;
|
|
7
7
|
childContextTypes?: {} | undefined;
|
|
8
8
|
}) => ReactWrapper<P & WrappedComponentProps, S, C>;
|
|
9
|
-
export declare const shallowWithIntlContext: <P, S, C extends
|
|
9
|
+
export declare const shallowWithIntlContext: <P, S, C extends Component<P, S> = Component<P, S>>(node: ReactElement<P & WrappedComponentProps>, { context, ...additionalOptions }?: {
|
|
10
10
|
context?: {} | undefined;
|
|
11
11
|
}) => ShallowWrapper<P & WrappedComponentProps, S, C>;
|
|
12
12
|
export declare const mountWithIntlWrapper: (node: React.ReactElement) => ReactWrapper;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
export declare const Matrix: import("@emotion/styled").StyledComponent<{
|
|
3
|
-
theme?: import("@emotion/react").Theme
|
|
4
|
-
as?:
|
|
2
|
+
theme?: import("@emotion/react").Theme;
|
|
3
|
+
as?: React.ElementType;
|
|
5
4
|
}, import("react").DetailedHTMLProps<import("react").TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>, {}>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-test-helpers",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "38.0.0",
|
|
4
4
|
"description": "Collection of test helpers used in media component stories and specs",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
"@atlaskit/button": "^23.3.0",
|
|
29
29
|
"@atlaskit/checkbox": "^17.1.0",
|
|
30
30
|
"@atlaskit/form": "^12.0.0",
|
|
31
|
-
"@atlaskit/icon": "^27.
|
|
31
|
+
"@atlaskit/icon": "^27.12.0",
|
|
32
32
|
"@atlaskit/locale": "^3.0.0",
|
|
33
|
-
"@atlaskit/media-client": "^35.
|
|
33
|
+
"@atlaskit/media-client": "^35.3.0",
|
|
34
34
|
"@atlaskit/media-common": "^12.3.0",
|
|
35
35
|
"@atlaskit/media-ui": "^28.6.0",
|
|
36
36
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
@@ -61,8 +61,7 @@
|
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@atlaskit/media-core": "^37.0.0",
|
|
63
63
|
"@types/exenv": "^1.2.0",
|
|
64
|
-
"react-dom": "^18.2.0"
|
|
65
|
-
"typescript": "~5.4.2"
|
|
64
|
+
"react-dom": "^18.2.0"
|
|
66
65
|
},
|
|
67
66
|
"af:exports": {
|
|
68
67
|
"./renderWithIntl": "./src/renderWithIntl.tsx",
|