Migrated tests to jest
Used jest-codemods to migrate, will have to pass everything by hand before we can merge.
This commit is contained in:
9
test5/parseCookie/parseCookie.js
Normal file
9
test5/parseCookie/parseCookie.js
Normal file
@@ -0,0 +1,9 @@
|
||||
const parseCookie = str =>
|
||||
str
|
||||
.split(';')
|
||||
.map(v => v.split('='))
|
||||
.reduce((acc, v) => {
|
||||
acc[decodeURIComponent(v[0].trim())] = decodeURIComponent(v[1].trim());
|
||||
return acc;
|
||||
}, {});
|
||||
module.exports = parseCookie;
|
||||
9
test5/parseCookie/parseCookie.test.js
Normal file
9
test5/parseCookie/parseCookie.test.js
Normal file
@@ -0,0 +1,9 @@
|
||||
const expect = require('expect');
|
||||
const parseCookie = require('./parseCookie.js');
|
||||
|
||||
test('Testing parseCookie', () => {
|
||||
//For more information on all the methods supported by tape
|
||||
//Please go to https://github.com/substack/tape
|
||||
expect(typeof parseCookie === 'function').toBeTruthy();
|
||||
expect(parseCookie('foo=bar; equation=E%3Dmc%5E2')).toEqual({ foo: 'bar', equation: 'E=mc^2' });
|
||||
});
|
||||
Reference in New Issue
Block a user