Test migration to jest by hand
Apparently using regular expressions is way easier.
This commit is contained in:
2
test/shallowClone/shallowClone.js
Normal file
2
test/shallowClone/shallowClone.js
Normal file
@ -0,0 +1,2 @@
|
||||
const shallowClone = obj => Object.assign({}, obj);
|
||||
module.exports = shallowClone;
|
||||
13
test/shallowClone/shallowClone.test.js
Normal file
13
test/shallowClone/shallowClone.test.js
Normal file
@ -0,0 +1,13 @@
|
||||
const expect = require('expect');
|
||||
const shallowClone = require('./shallowClone.js');
|
||||
|
||||
|
||||
test('shallowClone is a Function', () => {
|
||||
expect(shallowClone).toBeInstanceOf(Function);
|
||||
});
|
||||
const a = { foo: 'bar', obj: { a: 1, b: 2 } };
|
||||
const b = shallowClone(a);
|
||||
t.notEqual(a, b, 'Shallow cloning works');
|
||||
t.equal(a.obj, b.obj, 'Does not clone deeply');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user