Skip to content

Commit

Permalink
Merge pull request #19 from kriswep/maintenance
Browse files Browse the repository at this point in the history
fix lint config
  • Loading branch information
kriswep committed Jun 27, 2017
2 parents a464054 + e257828 commit 8bf1551
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 17 deletions.
16 changes: 9 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,14 @@
},
"eslintConfig": {
"extends": "airbnb",
"no-param-reassign": [
"warning",
{
"props": false
}
],
"rules": {
"no-param-reassign": [
"warn",
{
"props": false
}
]
},
"plugins": [
"import"
]
Expand Down Expand Up @@ -93,4 +95,4 @@
"dependencies": {
"offline-plugin": "^4.6.2"
}
}
}
14 changes: 4 additions & 10 deletions src/sound.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,11 @@
import 'web-audio-mock';
import sound from './sound';




test('Sound should have a init function which inits audioContext', () => {
// mock window.webkitAudioContext, window.AudioConext is mocked through import above
// small localStorage mock
global.localStorage = {
getItem: jest.fn()
.mockImplementation(() => null),
getItem: jest.fn().mockImplementation(() => null),
setItem: jest.fn(),
};
window.webkitAudioContext = window.AudioContext;
Expand All @@ -26,8 +22,7 @@ test('Sound should have a init function which inits audioContext', () => {
// remock window.AudioContext
// small localStorage mock
global.localStorage = {
getItem: jest.fn()
.mockImplementation(() => 1),
getItem: jest.fn().mockImplementation(() => 1),
setItem: jest.fn(),
};
window.AudioContext = window.webkitAudioContext;
Expand All @@ -53,7 +48,8 @@ test('Sound should have a playPlop function', () => {
test('Sound should maintain volume', () => {
// small localStorage mock
global.localStorage = {
getItem: jest.fn()
getItem: jest
.fn()
.mockImplementationOnce(() => null)
.mockImplementationOnce(() => 1)
.mockImplementationOnce(() => 0)
Expand All @@ -67,8 +63,6 @@ test('Sound should maintain volume', () => {
expect(sound.getVolume()).toBe(0);
expect(sound.getVolume()).toBe(0.5);


expect(sound.setVolume.bind(sound, [0.3])).not.toThrow();
expect(global.localStorage.setItem.mock.calls[0]).toEqual(['sound', [0.3]]);
});

0 comments on commit 8bf1551

Please sign in to comment.