@atlaskit/media-test-helpers 37.0.3 → 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 CHANGED
@@ -1,5 +1,19 @@
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
+
11
+ ## 37.0.4
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies
16
+
3
17
  ## 37.0.3
4
18
 
5
19
  ### Patch Changes
@@ -14,6 +14,8 @@ var _locales = require("@atlaskit/media-ui/locales");
14
14
  var _primitives = require("@atlaskit/primitives");
15
15
  var _form = require("@atlaskit/form");
16
16
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
17
+ // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
18
+
17
19
  function getMessages(localeValue) {
18
20
  var lang = localeValue.substring(0, 2);
19
21
  var langWithRegion = localeValue.replace('-', '_');
@@ -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,8 @@ var _popup = _interopRequireDefault(require("@atlaskit/popup"));
23
23
  var _checkbox = require("@atlaskit/checkbox");
24
24
  var _mediaCommon = require("@atlaskit/media-common");
25
25
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof3(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
26
+ // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
27
+
26
28
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
27
29
 
28
30
  var camelCaseToSentenceCase = function camelCaseToSentenceCase(text) {
@@ -2,6 +2,7 @@ import React, { useState } from 'react';
2
2
  import { IntlProvider } from 'react-intl-next';
3
3
  import LocaleSelect, { defaultLocales } from '@atlaskit/locale/LocaleSelect';
4
4
  import { locales } from '@atlaskit/media-ui/locales';
5
+ // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
5
6
  import { Box, xcss } from '@atlaskit/primitives';
6
7
  import { Label } from '@atlaskit/form';
7
8
  function getMessages(localeValue) {
@@ -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() {}
@@ -6,6 +6,7 @@ import SelectClearIcon from '@atlaskit/icon/core/migration/cross-circle--select-
6
6
  import HipchatChevronDownIcon from '@atlaskit/icon/core/migration/chevron-down--hipchat-chevron-down';
7
7
  import Button from '@atlaskit/button/standard-button';
8
8
  import { fg } from '@atlaskit/platform-feature-flags';
9
+ // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
9
10
  import { Stack, xcss } from '@atlaskit/primitives';
10
11
  import Tooltip from '@atlaskit/tooltip';
11
12
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
@@ -3,6 +3,7 @@ import React, { useState } from 'react';
3
3
  import { IntlProvider } from 'react-intl-next';
4
4
  import LocaleSelect, { defaultLocales } from '@atlaskit/locale/LocaleSelect';
5
5
  import { locales } from '@atlaskit/media-ui/locales';
6
+ // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
6
7
  import { Box, xcss } from '@atlaskit/primitives';
7
8
  import { Label } from '@atlaskit/form';
8
9
  function getMessages(localeValue) {
@@ -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] : {
@@ -8,6 +8,7 @@ import SelectClearIcon from '@atlaskit/icon/core/migration/cross-circle--select-
8
8
  import HipchatChevronDownIcon from '@atlaskit/icon/core/migration/chevron-down--hipchat-chevron-down';
9
9
  import Button from '@atlaskit/button/standard-button';
10
10
  import { fg } from '@atlaskit/platform-feature-flags';
11
+ // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
11
12
  import { Stack, xcss } from '@atlaskit/primitives';
12
13
  import Tooltip from '@atlaskit/tooltip';
13
14
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
@@ -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: number;
50
+ readonly timeStamp: DOMHighResTimeStamp;
51
51
  readonly type: string;
52
52
  composedPath(): EventTarget[];
53
- initEvent(type: string, bubbles?: boolean | undefined, cancelable?: boolean | undefined): void;
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 | undefined, cancelableArg?: boolean | undefined, viewArg?: Window | null | undefined, detailArg?: number | undefined): void;
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: number;
110
+ readonly timeStamp: DOMHighResTimeStamp;
111
111
  readonly type: string;
112
112
  composedPath(): EventTarget[];
113
- initEvent(type: string, bubbles?: boolean | undefined, cancelable?: boolean | undefined): void;
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 | undefined;
5
- collectionName?: string | undefined;
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
  interface MockedJest<F, S> {
3
2
  fn: (value?: F) => MockStub<F, F>;
4
3
  spyOn: () => MockStub<S, S>;
@@ -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,4 +1,3 @@
1
- /// <reference types="jest" />
2
1
  export declare function mockCanvas(width?: number, height?: number): {
3
2
  canvas: {
4
3
  width: number;
@@ -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 React.Component<P, S, any> = React.Component<P, S, any>>(node: ReactElement<P & WrappedComponentProps>, { context, childContextTypes, ...additionalOptions }?: {
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 React.Component<P, S, any> = React.Component<P, S, any>>(node: ReactElement<P & WrappedComponentProps>, { context, ...additionalOptions }?: {
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 | undefined;
4
- as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
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: number;
50
+ readonly timeStamp: DOMHighResTimeStamp;
51
51
  readonly type: string;
52
52
  composedPath(): EventTarget[];
53
- initEvent(type: string, bubbles?: boolean | undefined, cancelable?: boolean | undefined): void;
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 | undefined, cancelableArg?: boolean | undefined, viewArg?: Window | null | undefined, detailArg?: number | undefined): void;
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: number;
110
+ readonly timeStamp: DOMHighResTimeStamp;
111
111
  readonly type: string;
112
112
  composedPath(): EventTarget[];
113
- initEvent(type: string, bubbles?: boolean | undefined, cancelable?: boolean | undefined): void;
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 | undefined;
5
- collectionName?: string | undefined;
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
  interface MockedJest<F, S> {
3
2
  fn: (value?: F) => MockStub<F, F>;
4
3
  spyOn: () => MockStub<S, S>;
@@ -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,4 +1,3 @@
1
- /// <reference types="jest" />
2
1
  export declare function mockCanvas(width?: number, height?: number): {
3
2
  canvas: {
4
3
  width: number;
@@ -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 React.Component<P, S, any> = React.Component<P, S, any>>(node: ReactElement<P & WrappedComponentProps>, { context, childContextTypes, ...additionalOptions }?: {
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 React.Component<P, S, any> = React.Component<P, S, any>>(node: ReactElement<P & WrappedComponentProps>, { context, ...additionalOptions }?: {
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 | undefined;
4
- as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
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": "37.0.3",
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/"
@@ -25,21 +25,21 @@
25
25
  "team": "Media Exif"
26
26
  },
27
27
  "dependencies": {
28
- "@atlaskit/button": "^23.2.0",
28
+ "@atlaskit/button": "^23.3.0",
29
29
  "@atlaskit/checkbox": "^17.1.0",
30
30
  "@atlaskit/form": "^12.0.0",
31
- "@atlaskit/icon": "^27.2.0",
31
+ "@atlaskit/icon": "^27.12.0",
32
32
  "@atlaskit/locale": "^3.0.0",
33
- "@atlaskit/media-client": "^35.0.0",
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",
37
37
  "@atlaskit/popup": "^4.3.0",
38
- "@atlaskit/primitives": "^14.10.0",
38
+ "@atlaskit/primitives": "^14.11.0",
39
39
  "@atlaskit/tabs": "^18.1.0",
40
40
  "@atlaskit/textfield": "^8.0.0",
41
- "@atlaskit/tokens": "^5.4.0",
42
- "@atlaskit/tooltip": "^20.3.0",
41
+ "@atlaskit/tokens": "^6.0.0",
42
+ "@atlaskit/tooltip": "^20.4.0",
43
43
  "@atlaskit/ufo": "^0.4.0",
44
44
  "@babel/runtime": "^7.0.0",
45
45
  "@emotion/react": "^11.7.1",
@@ -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",