diff --git a/packages/web/jest.config.js b/packages/web/jest.config.js index 1629880406d..27180ac8b6c 100644 --- a/packages/web/jest.config.js +++ b/packages/web/jest.config.js @@ -3,8 +3,13 @@ const defaultConfig = require('../../jest.config.js') module.exports = { ...defaultConfig, globals: { - navigator: true, - window: true, + 'ts-jest': { + isolatedModules: true, + tsConfig: 'tsconfig.jest.json', + }, + }, + moduleNameMapper: { + 'src/(.*)$': '/src/$1', }, preset: 'react-native-web', testEnvironment: 'node', diff --git a/packages/web/src/brandkit/common/DownloadButton.tsx b/packages/web/src/brandkit/common/DownloadButton.tsx index 6d3c45050fc..c56f5ffb72c 100644 --- a/packages/web/src/brandkit/common/DownloadButton.tsx +++ b/packages/web/src/brandkit/common/DownloadButton.tsx @@ -1,3 +1,4 @@ +import * as React from 'react' import { brandStyles } from 'src/brandkit/common/constants' import { I18nProps, NameSpaces, withNamespaces } from 'src/i18n' import Download from 'src/icons/Download' diff --git a/packages/web/src/brandkit/tests/Showcase.test.tsx b/packages/web/src/brandkit/tests/Showcase.test.tsx new file mode 100644 index 00000000000..589ec4bccf6 --- /dev/null +++ b/packages/web/src/brandkit/tests/Showcase.test.tsx @@ -0,0 +1,20 @@ +import * as React from 'react' +import * as renderer from 'react-test-renderer' +import Showcase from 'src/brandkit/common/Showcase' + +describe('Showcase', () => { + it('renders', () => { + const showCase = renderer + .create( + + ) + .toJSON() + expect(showCase).toMatchSnapshot() + }) +}) diff --git a/packages/web/src/brandkit/tests/__snapshots__/Showcase.test.tsx.snap b/packages/web/src/brandkit/tests/__snapshots__/Showcase.test.tsx.snap new file mode 100644 index 00000000000..0639733073f --- /dev/null +++ b/packages/web/src/brandkit/tests/__snapshots__/Showcase.test.tsx.snap @@ -0,0 +1,244 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Showcase renders 1`] = ` +
+
+
+
+
+
+
+
+
+
+
+
+
+ test +
+
+ Trust, Attest, Verify +
+
+ +
+`; diff --git a/packages/web/tsconfig.jest.json b/packages/web/tsconfig.jest.json new file mode 100644 index 00000000000..ec83611f0c5 --- /dev/null +++ b/packages/web/tsconfig.jest.json @@ -0,0 +1,6 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "jsx": "react" + } +}