mirror of
https://github.com/tenrok/axios.git
synced 2026-06-17 19:21:29 +03:00
ef3711d1b3
* feat: implement prettier and fix all issues * fix: failing tests * fix: implement feedback from codel, ai etc * chore: dont throw in trim function Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com> * fix: incorrect fix --------- Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
40 lines
787 B
JavaScript
40 lines
787 B
JavaScript
import utils from '../../../lib/utils';
|
|
|
|
const { extend } = utils;
|
|
|
|
describe('utils::extend', function () {
|
|
it('should be mutable', function () {
|
|
const a = {};
|
|
const b = { foo: 123 };
|
|
|
|
extend(a, b);
|
|
|
|
expect(a.foo).toEqual(b.foo);
|
|
});
|
|
|
|
it('should extend properties', function () {
|
|
let a = { foo: 123, bar: 456 };
|
|
const b = { bar: 789 };
|
|
|
|
a = extend(a, b);
|
|
|
|
expect(a.foo).toEqual(123);
|
|
expect(a.bar).toEqual(789);
|
|
});
|
|
|
|
it('should bind to thisArg', function () {
|
|
const a = {};
|
|
const b = {
|
|
getFoo: function getFoo() {
|
|
return this.foo;
|
|
},
|
|
};
|
|
const thisArg = { foo: 'barbaz' };
|
|
|
|
extend(a, b, thisArg);
|
|
|
|
expect(typeof a.getFoo).toEqual('function');
|
|
expect(a.getFoo()).toEqual(thisArg.foo);
|
|
});
|
|
});
|