diff --git a/components/note/__tests__/__snapshots__/index.test.tsx.snap b/components/note/__tests__/__snapshots__/index.test.tsx.snap new file mode 100644 index 0000000..012d1d1 --- /dev/null +++ b/components/note/__tests__/__snapshots__/index.test.tsx.snap @@ -0,0 +1,211 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Note should render correctly 1`] = ` +"
note:note
" +`; + +exports[`Note should work with different styles 1`] = ` +"
note:secondary
note:success
note:warning
note:error
" +`; + +exports[`Note should work with different types 1`] = ` +"
note:secondary
note:success
note:warning
note:error
" +`; diff --git a/components/note/__tests__/index.test.tsx b/components/note/__tests__/index.test.tsx new file mode 100644 index 0000000..388065e --- /dev/null +++ b/components/note/__tests__/index.test.tsx @@ -0,0 +1,48 @@ +import React from 'react' +import { mount } from 'enzyme' +import { Note } from 'components' +import { updateWrapper } from 'tests/utils' + +describe('Note', () => { + it('should render correctly', () => { + const wrapper = mount(note) + expect(wrapper.html()).toMatchSnapshot() + expect(() => wrapper.unmount()).not.toThrow() + }) + + it('should work with different types', () => { + const wrapper = mount( +
+ secondary + success + warning + error +
+ ) + expect(wrapper.html()).toMatchSnapshot() + expect(() => wrapper.unmount()).not.toThrow() + }) + + it('custom labels should be rendered', async () => { + const wrapper = mount(note) + expect(wrapper.find('.label').length).toBe(0) + + wrapper.setProps({ label: 'test' }) + await updateWrapper(wrapper) + expect(wrapper.find('.label').text().toLowerCase()) + .toContain('test') + }) + + it('should work with different styles', () => { + const wrapper = mount( +
+ secondary + success + warning + error +
+ ) + expect(wrapper.html()).toMatchSnapshot() + expect(() => wrapper.unmount()).not.toThrow() + }) +})