-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
79d440d
commit 65a515e
Showing
12 changed files
with
2,457 additions
and
129 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,18 @@ | ||
module.exports = { | ||
presets: [ | ||
'@babel/preset-env', | ||
['@babel/preset-react', { useSpread: true }], | ||
'@babel/preset-typescript' | ||
], | ||
plugins: [ | ||
[ | ||
'module-resolver', | ||
{ | ||
root: ['./src'], | ||
alias: { | ||
test: './test' | ||
} | ||
} | ||
] | ||
] | ||
} |
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,69 @@ | ||
const path = require('path') | ||
|
||
module.exports = { | ||
parser: '@typescript-eslint/parser', | ||
extends: [ | ||
'standard', | ||
'standard-react', | ||
'prettier/standard', | ||
'prettier/react' | ||
], | ||
plugins: ['prettier', 'react-hooks', '@typescript-eslint'], | ||
env: { | ||
node: true | ||
}, | ||
parserOptions: { | ||
ecmaVersion: 2020, | ||
ecmaFeatures: { | ||
legacyDecorators: true, | ||
jsx: true | ||
} | ||
}, | ||
rules: { | ||
'space-before-function-paren': 0, | ||
'react/prop-types': 0, | ||
'react/jsx-handler-names': 0, | ||
'react/jsx-fragments': 0, | ||
'react/no-unused-prop-types': 0, | ||
'import/export': 0, | ||
'import/order': [ | ||
2, | ||
{ groups: ['parent', 'sibling'], 'newlines-between': 'always' } | ||
], | ||
'prefer-promise-reject-errors': 'off', | ||
'react/jsx-filename-extension': 'off', | ||
'react/forbid-prop-types': 'off', | ||
'import/prefer-default-export': 'off', | ||
'no-plusplus': 'off', | ||
'no-return-assign': 'off', | ||
'no-nested-ternary': 'off', | ||
'no-param-reassign': 'off', | ||
'no-continue': 'off', | ||
'func-names': 'off', | ||
'no-bitwise': 'off', | ||
'consistent-return': 'off', | ||
'import/no-webpack-loader-syntax': 'off', | ||
'no-restricted-globals': 'off', | ||
'react-hooks/rules-of-hooks': 'error', | ||
'react-hooks/exhaustive-deps': 'warn', | ||
'react/jsx-curly-newline': 'off', | ||
'no-unused-vars': 'off', | ||
'@typescript-eslint/no-unused-vars': 'error' | ||
}, | ||
settings: { | ||
react: { | ||
version: '16' | ||
}, | ||
'import/resolver': { | ||
alias: { | ||
map: [ | ||
['fiber', './src'], | ||
['test', './test'] | ||
] | ||
}, | ||
node: { | ||
extensions: ['.js', '.jsx', '.ts', '.tsx'] | ||
} | ||
} | ||
} | ||
} |
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,16 @@ | ||
module.exports = { | ||
preset: 'ts-jest', | ||
roots: ['src'], | ||
moduleFileExtensions: ['js', 'ts', 'tsx', 'json'], | ||
testPathIgnorePatterns: ['./node_modules/'], | ||
setupFilesAfterEnv: [require.resolve('./test/jest.setup.ts')], | ||
moduleNameMapper: { | ||
'test/(.*)': '<rootDir>/test/$1' | ||
// '^@components(.*)$': '<rootDir>/src/components$1', | ||
// '^@constants(.*)$': '<rootDir>/src/constants$1' | ||
}, | ||
testEnvironment: 'node', | ||
transform: { | ||
'^.+\\.(js|jsx|ts|tsx)$': 'ts-jest' | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,19 @@ | ||
import { ExampleComponent } from '..' | ||
|
||
import React from 'react' | ||
import { render } from 'test/utils' | ||
|
||
describe('ExampleComponent', () => { | ||
it('is truthy', () => { | ||
expect(ExampleComponent).toBeTruthy() | ||
it('renders correctly', () => { | ||
const exampleComponent = render( | ||
<ExampleComponent | ||
locale={{ welcome: 'locale overwrite' }} | ||
mt='516px' | ||
background='pink' | ||
text='text' | ||
/> | ||
) | ||
|
||
expect(exampleComponent).toMatchSnapshot() | ||
}) | ||
}) |
14 changes: 14 additions & 0 deletions
14
src/ExampleComponent/__tests__/__snapshots__/ExampleComponent.spec.tsx.snap
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,14 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`ExampleComponent renders correctly 1`] = ` | ||
<div | ||
className="sc-AxjAm kEIyNd" | ||
> | ||
locale overwrite | ||
text | ||
subText | ||
</div> | ||
`; |
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export * from './UIProvider' | ||
export * from './locales' | ||
export * from './themes' |
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,4 @@ | ||
import { configure } from 'enzyme' | ||
import Adapter from 'enzyme-adapter-react-16' | ||
|
||
configure({ adapter: new Adapter() }) |
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,11 @@ | ||
import { UIProvider } from '../src' | ||
import defaultTheme, { ThemeType } from '../src/UIProvider/themes' | ||
|
||
import renderer from 'react-test-renderer' | ||
import React, { ReactChild } from 'react' | ||
|
||
const { light } = defaultTheme | ||
|
||
// Provides UI Context to tested components | ||
export const render = (node: ReactChild, theme: ThemeType = light) => | ||
renderer.create(<UIProvider theme={theme}>{node}</UIProvider>).toJSON() |
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
Oops, something went wrong.