Skip to content

Instantly share code, notes, and snippets.

@lupomontero
Created June 30, 2018 18:41
Show Gist options
  • Save lupomontero/2f36dd0c24a4d8ec53250a2e730fe0e0 to your computer and use it in GitHub Desktop.
Save lupomontero/2f36dd0c24a4d8ec53250a2e730fe0e0 to your computer and use it in GitHub Desktop.
const double = require('./double-1');
describe('double', () => {
it('should create new array without mutating ref declared in outer scope', () => {
const a = [1, 2, 3];
const b = double(a)
expect(a).toEqual([1, 2, 3]);
expect(b).toEqual([2, 4, 6]);
expect(a).not.toBe(b);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment