Test migration to jest by hand
Apparently using regular expressions is way easier.
This commit is contained in:
6
test/getURLParameters/getURLParameters.js
Normal file
6
test/getURLParameters/getURLParameters.js
Normal file
@ -0,0 +1,6 @@
|
||||
const getURLParameters = url =>
|
||||
(url.match(/([^?=&]+)(=([^&]*))/g) || []).reduce(
|
||||
(a, v) => ((a[v.slice(0, v.indexOf('='))] = v.slice(v.indexOf('=') + 1)), a),
|
||||
{}
|
||||
);
|
||||
module.exports = getURLParameters;
|
||||
9
test/getURLParameters/getURLParameters.test.js
Normal file
9
test/getURLParameters/getURLParameters.test.js
Normal file
@ -0,0 +1,9 @@
|
||||
const expect = require('expect');
|
||||
const getURLParameters = require('./getURLParameters.js');
|
||||
|
||||
|
||||
test('getURLParameters is a Function', () => {
|
||||
expect(getURLParameters).toBeInstanceOf(Function);
|
||||
});
|
||||
t.deepEqual(getURLParameters('http:
|
||||
|
||||
Reference in New Issue
Block a user