Skip to content

Commit

Permalink
Convert @zooniverse/async-states to ES6
Browse files Browse the repository at this point in the history
Switch `@zooniverse/async-states` from `require` to static `import` and `export`.
  • Loading branch information
eatyourgreens committed Nov 28, 2022
1 parent 9a89c35 commit c9ec2b6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
1 change: 1 addition & 0 deletions packages/lib-async-states/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"bugs": "https://github.com/zooniverse/front-end-monorepo/issues",
"version": "0.0.1",
"main": "src/async-states.js",
"type": "module",
"scripts": {
"lint": "zoo-standard src --fix | snazzy",
"test": "mocha --config ./test/.mocharc.json \"./src/async-states.spec.js\"",
Expand Down
2 changes: 1 addition & 1 deletion packages/lib-async-states/src/async-states.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ Object.defineProperty(asyncStates, 'values', {
value: Object.values(asyncStates)
})

module.exports = asyncStates
export default asyncStates
8 changes: 3 additions & 5 deletions packages/lib-async-states/src/async-states.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const asyncStates = require('./async-states')
import asyncStates from './async-states.js'

describe('asyncStates', function () {
const states = [
Expand All @@ -17,8 +17,7 @@ describe('asyncStates', function () {
})

it('should be immutable', function () {
asyncStates[state] = 'foobar'
expect(asyncStates[state]).to.equal(state)
expect(() => asyncStates[state] = 'foobar').to.throw()
})
})
})
Expand All @@ -29,8 +28,7 @@ describe('asyncStates', function () {
})

it('should be immutable', function () {
asyncStates.values = 'foobar'
expect(asyncStates.values).to.deep.equal(states)
expect(() => asyncStates.values = 'foobar').to.throw()
})
})
})

0 comments on commit c9ec2b6

Please sign in to comment.