Skip to content

Commit 77e74c1

Browse files
author
Fabien JUIF
committed
🐛 fix TailSpin test
1 parent 596e393 commit 77e74c1

File tree

6 files changed

+13
-37
lines changed

6 files changed

+13
-37
lines changed

misc/rebuild_refs.sh

Lines changed: 0 additions & 9 deletions
This file was deleted.

misc/requestAnimationFrame.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
global.requestAnimationFrame = (cb) => {
2+
setTimeout(cb, 0)
3+
}

misc/testSetup.js

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,5 @@
1-
import { jsdom } from 'jsdom'
2-
import chai from 'chai'
3-
import spies from 'chai-spies'
1+
import './requestAnimationFrame'
42
import Enzyme from 'enzyme'
53
import Adapter from 'enzyme-adapter-react-16'
64

7-
global.document = jsdom('<!doctype html><html><body></body></html>')
8-
global.window = document.defaultView
9-
global.navigator = global.window.navigator
10-
11-
/** Configuring chai. */
12-
chai.should()
13-
chai.config.includeStack = true
14-
chai.config.truncateThreshold = 0
15-
chai.use(spies)
16-
17-
// Make console.error a real failure
18-
console.error = (message) => { // eslint-disable-line no-console
19-
throw new Error(message)
20-
}
21-
22-
// enzyme
235
Enzyme.configure({ adapter: new Adapter() })

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,5 +91,10 @@
9191
"import/no-unresolved": 0,
9292
"react/forbid-prop-types": 0
9393
}
94+
},
95+
"jest": {
96+
"setupFiles": [
97+
"./misc/testSetup.js"
98+
]
9499
}
95100
}

src/TailSpin/TailSpin.spec.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
1-
/* eslint-env mocha */
1+
/* eslint-env jest */
2+
23
/* eslint-disable
3-
no-unused-expressions,
4-
react/jsx-filename-extension,
5-
import/no-extraneous-dependencies
4+
react/jsx-filename-extension
65
*/
76

87
import React from 'react'
98
import { mount } from 'enzyme'
10-
import blanket from 'blanket' // eslint-disable-line
119
import TailSpin from './TailSpin'
1210

1311
const testColor = (component, color) => {
14-
component.find('circle').props().fill.should.be.deep.equals(color)
12+
expect(component.find('circle').props().fill).toEqual(color)
1513
}
1614

1715
describe('TailSpin', () => {
@@ -60,5 +58,3 @@ describe('TailSpin', () => {
6058
)
6159
})
6260
})
63-
64-
/* eslint-enable no-unused-expressions */

src/index.spec.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import React from 'react'
99
import { mount } from 'enzyme'
1010
import { expect, spy } from 'chai'
11-
import blanket from 'blanket' // eslint-disable-line
1211
import loader from './index'
1312
import TailSpin from './TailSpin'
1413

0 commit comments

Comments
 (0)