mirror of
https://github.com/tenrok/axios.git
synced 2026-06-17 19:21:29 +03:00
fa337332b9
* chore: small fixes to tests * feat: transitional move to vitests * feat: moving unit tests in progress * feat: moving more unit tests over * feat: more tests moved * feat: updated more sections of the http test * chore: wip http tests * chore: wip http tests * chore: more http tests * chore: tests * chore: tests * chore: tests * chore: tests * chore: tests * chore: tests * chore: tests * chore: tests * chore: tests * chore: tests * chore: tests * chore: tests * chore: tests * chore: tests * chore: tests * chore: tests * chore: tests * chore: tests * chore: tests * chore: tests * chore: tests * chore: tests * chore: tests * chore: tests * chore: tests * chore: remove un-needed docs * chore: update package lock * chore: update lock
41 lines
810 B
JavaScript
41 lines
810 B
JavaScript
/* eslint-env mocha */
|
|
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);
|
|
});
|
|
});
|