Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start adding unit tests in repository
- Loading branch information
1 parent
f11d841
commit 88f139a
Showing
8 changed files
with
127 additions
and
1 deletion.
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 |
---|---|---|
|
@@ -32,6 +32,7 @@ media/* | |
*.sass-cache | ||
.idea | ||
.coverage | ||
coverage | ||
coverage_html_report/ | ||
npm-debug.log* | ||
|
||
|
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import React from 'react'; | ||
import { Entity } from 'draft-js'; | ||
import Document from './Document'; | ||
import { shallow } from 'enzyme'; | ||
|
||
describe('Document', () => { | ||
it('exists', () => { | ||
expect(Document).toBeDefined(); | ||
}); | ||
|
||
it('renders', () => { | ||
const entityKey = Entity.create('DOCUMENT', 'MUTABLE', { title: 'Test title' }); | ||
expect(shallow(( | ||
<Document entityKey={entityKey}> | ||
<span>Test children</span> | ||
</Document> | ||
))).toMatchSnapshot(); | ||
}) | ||
}); |
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,28 @@ | ||
import React from 'react'; | ||
import { Entity } from 'draft-js'; | ||
import Link from './Link'; | ||
import { shallow } from 'enzyme'; | ||
|
||
describe('Link', () => { | ||
it('exists', () => { | ||
expect(Link).toBeDefined(); | ||
}); | ||
|
||
it('renders', () => { | ||
const entityKey = Entity.create('LINK', 'MUTABLE', { url: 'http://example.com/' }); | ||
expect(shallow(( | ||
<Link entityKey={entityKey}> | ||
<span>Test children</span> | ||
</Link> | ||
))).toMatchSnapshot(); | ||
}); | ||
|
||
it('renders email', () => { | ||
const entityKey = Entity.create('LINK', 'MUTABLE', { url: 'mailto:test@example.com' }); | ||
expect(shallow(( | ||
<Link entityKey={entityKey}> | ||
<span>Test children</span> | ||
</Link> | ||
))).toMatchSnapshot(); | ||
}); | ||
}); |
18 changes: 18 additions & 0 deletions
18
wagtaildraftail/client/entities/__snapshots__/Document.test.js.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,18 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Document renders 1`] = ` | ||
<span | ||
className="RichEditor-link" | ||
data-tooltip="1" | ||
title="Test title" | ||
> | ||
<Icon | ||
className="" | ||
name="icon-doc-full" | ||
title={null} | ||
/> | ||
<span> | ||
Test children | ||
</span> | ||
</span> | ||
`; |
33 changes: 33 additions & 0 deletions
33
wagtaildraftail/client/entities/__snapshots__/Link.test.js.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,33 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Link renders 1`] = ` | ||
<span | ||
className="RichEditor-link" | ||
data-tooltip="1" | ||
> | ||
<Icon | ||
className="" | ||
name="icon-link" | ||
title={null} | ||
/> | ||
<span> | ||
Test children | ||
</span> | ||
</span> | ||
`; | ||
|
||
exports[`Link renders email 1`] = ` | ||
<span | ||
className="RichEditor-link" | ||
data-tooltip="2" | ||
> | ||
<Icon | ||
className="" | ||
name="icon-mail" | ||
title={null} | ||
/> | ||
<span> | ||
Test children | ||
</span> | ||
</span> | ||
`; |
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 @@ | ||
module.exports = {}; |
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 initDraftailEditor from './wagtaildraftail'; | ||
|
||
describe('wagtaildraftail', () => { | ||
it('exists', () => { | ||
expect(initDraftailEditor).toBeInstanceOf(Function); | ||
}) | ||
|
||
it('is exposed as global', () => { | ||
expect(window.initDraftailEditor).toBe(initDraftailEditor); | ||
}) | ||
}); |