Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
swifteditor
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fukai
swifteditor
Commits
8f6672d0
Commit
8f6672d0
authored
Jul 27, 2016
by
bert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
学习单元测试
parent
90685be1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
0 deletions
+39
-0
Root.spec.js
tests/containers/Root.spec.js
+25
-0
helloWorld.spec.js
tests/helloWorld.spec.js
+8
-0
test_helper.js
tests/test_helper.js
+6
-0
No files found.
tests/containers/Root.spec.js
0 → 100644
View file @
8f6672d0
import
React
from
'react'
;
// required to get test to work. we can get around this later with more configuration
import
{
shallow
}
from
'enzyme'
;
// method from enzyme which allows us to do shallow render
import
Root
from
'../../views/Demo/Root'
;
// import our soon to be component
describe
(
'(Container) Root'
,
()
=>
{
it
(
'renders as a <div>'
,
()
=>
{
const
wrapper
=
shallow
(
<
Root
/>
);
expect
(
wrapper
.
type
()).
to
.
eql
(
'div'
);
});
it
(
'has style with height 100%'
,
()
=>
{
const
wrapper
=
shallow
(
<
Root
/>
);
const
expectedStyles
=
{
height
:
'100%'
,
background
:
'#333'
}
expect
(
wrapper
.
prop
(
'style'
)).
to
.
eql
(
expectedStyles
);
});
it
(
'contains a header explaining the app'
,
()
=>
{
const
wrapper
=
shallow
(
<
Root
/>
);
expect
(
wrapper
.
find
(
'.welcome-header'
)).
to
.
have
.
length
(
1
);
});
});
\ No newline at end of file
tests/helloWorld.spec.js
0 → 100644
View file @
8f6672d0
import
{
expect
}
from
'chai'
;
describe
(
'hello world'
,
()
=>
{
it
(
'works!'
,
()
=>
{
expect
(
true
).
to
.
be
.
true
;
});
});
\ No newline at end of file
tests/test_helper.js
0 → 100644
View file @
8f6672d0
import
{
expect
}
from
'chai'
;
import
sinon
from
'sinon'
;
global
.
expect
=
expect
;
global
.
sinon
=
sinon
;
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment