-
-
Notifications
You must be signed in to change notification settings - Fork 185
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3a854ba
commit c17d9cd
Showing
14 changed files
with
2,123 additions
and
257 deletions.
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
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 |
---|---|---|
|
@@ -29,4 +29,4 @@ cache: | |
test_script: | ||
- node --version | ||
- npm --version | ||
- cmd: 'yarn travis' | ||
- cmd: 'yarn test:ci' |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"env": { | ||
"mocha": true | ||
"jest": true | ||
} | ||
} |
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 |
---|---|---|
@@ -1,77 +1,64 @@ | ||
'use strict'; | ||
|
||
const assert = require('assert'); | ||
const loaderUtils = require('../lib'); | ||
|
||
describe('getOptions()', () => { | ||
describe('when loaderContext.query is a string with length > 0', () => { | ||
it('should call parseQuery() and return its result', () => { | ||
assert.deepEqual( | ||
expect( | ||
loaderUtils.getOptions({ | ||
query: '?something=getOptions_cannot_parse', | ||
}), | ||
{ something: 'getOptions_cannot_parse' } | ||
); | ||
}) | ||
).toEqual({ something: 'getOptions_cannot_parse' }); | ||
}); | ||
}); | ||
describe('when loaderContext.query is an empty string', () => { | ||
it('should return null', () => { | ||
assert.strictEqual( | ||
expect( | ||
loaderUtils.getOptions({ | ||
query: '', | ||
}), | ||
null | ||
); | ||
}) | ||
).toEqual(null); | ||
}); | ||
}); | ||
describe('when loaderContext.query is an object', () => { | ||
it('should just return it', () => { | ||
const query = {}; | ||
assert.strictEqual( | ||
expect( | ||
loaderUtils.getOptions({ | ||
query, | ||
}), | ||
query | ||
); | ||
}) | ||
).toEqual(query); | ||
}); | ||
}); | ||
describe('when loaderContext.query is an array', () => { | ||
it('should just return it', () => { | ||
const query = []; | ||
assert.strictEqual( | ||
loaderUtils.getOptions({ | ||
query, | ||
}), | ||
query | ||
); | ||
expect(loaderUtils.getOptions({ query })).toEqual(query); | ||
}); | ||
}); | ||
describe('when loaderContext.query is anything else', () => { | ||
it('should return null', () => { | ||
assert.strictEqual( | ||
expect( | ||
loaderUtils.getOptions({ | ||
query: undefined, | ||
}), | ||
null | ||
); | ||
assert.strictEqual( | ||
}) | ||
).toEqual(null); | ||
expect( | ||
loaderUtils.getOptions({ | ||
query: null, | ||
}), | ||
null | ||
); | ||
assert.strictEqual( | ||
}) | ||
).toEqual(null); | ||
expect( | ||
loaderUtils.getOptions({ | ||
query: 1, | ||
}), | ||
null | ||
); | ||
assert.strictEqual( | ||
}) | ||
).toEqual(null); | ||
expect( | ||
loaderUtils.getOptions({ | ||
query: 0, | ||
}), | ||
null | ||
); | ||
}) | ||
).toEqual(null); | ||
}); | ||
}); | ||
}); |
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
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
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
Oops, something went wrong.