1
0
mirror of https://github.com/lancedikson/bowser synced 2026-03-02 03:40:27 +00:00

Extended test cases and fixed bug

This commit is contained in:
Oliver foster
2019-12-19 12:00:46 +00:00
parent f27c7e0580
commit 5a6af193d2
2 changed files with 6 additions and 4 deletions

View File

@@ -107,9 +107,11 @@ test('find', (t) => {
t.is(result, 2);
const original = Array.prototype.find;
delete Array.prototype.find;
const polyfillResult = find([1,2], (value) => value==2);
const polyfillResultFound = find([1,2], (value) => value==2);
const polyfillResultNotFound = find([1,2], (value) => value==3);
Array.prototype.find = original;
t.is(polyfillResult, 2);
t.is(polyfillResultFound, 2);
t.is(polyfillResultNotFound, undefined);
});
test('assign', (t) => {
@@ -119,7 +121,7 @@ test('assign', (t) => {
t.is(result['c'], 3);
const original = Object.assign;
delete Object.assign;
const polyfillResult = assign({}, { a: 1 }, { b: 1 }, { b: 2, c: 3 });
const polyfillResult = assign({}, { a: 1 }, { b: 1 }, null, { b: 2, c: 3 });
Object.assign = original;
t.is(polyfillResult['a'], 1);
t.is(polyfillResult['b'], 2);