diff --git a/.jest.config.js b/.jest.config.js index 4b4fe9f..9203df8 100644 --- a/.jest.config.js +++ b/.jest.config.js @@ -12,9 +12,11 @@ module.exports = { }, testRegex: '.*\\.test\\.(j|t)sx?$', + // testRegex: 'button\\/.*\\.test\\.(j|t)sx?$', collectCoverageFrom: [ 'components/**/*.{ts,tsx}', + '!components/**/styles.{ts,tsx}', '!components/styles/*', '!components/index.ts', ], diff --git a/components/button/__tests__/__snapshots__/index.test.tsx.snap b/components/button/__tests__/__snapshots__/index.test.tsx.snap new file mode 100644 index 0000000..91307fa --- /dev/null +++ b/components/button/__tests__/__snapshots__/index.test.tsx.snap @@ -0,0 +1,33 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Button should render empty button correctly 1`] = ` + +`; + +exports[`Button should render special styles 1`] = `ReactWrapper {}`; + +exports[`Button should render special styles 2`] = ` + + button + +`; diff --git a/components/button/__tests__/index.test.tsx b/components/button/__tests__/index.test.tsx new file mode 100644 index 0000000..67facfc --- /dev/null +++ b/components/button/__tests__/index.test.tsx @@ -0,0 +1,128 @@ +import React from 'react' +import { mount } from 'enzyme' +import { Button } from '../../' +import { sleep } from '../../../tests/utils' + +describe('Button', () => { + it('should render correctly', () => { + const wrapper = mount(Button) + expect(() => wrapper.unmount()).not.toThrow() + }) + + it('should support all types', () => { + const wrapper = mount( +