Skip to content

Commit

Permalink
Added more tests to cover upsert
Browse files Browse the repository at this point in the history
  • Loading branch information
herecydev committed Mar 16, 2017
1 parent 237117c commit f62d69f
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions tests/merge-multiple-tests.js
Expand Up @@ -48,6 +48,29 @@ function multipleTests(merge) {
assert.deepEqual(merge(a, b), result);
});

it('should add different configurations without merging', function () {
const a = {
client: {
entry: './client.js'
}
};
const b = {
server: {
entry: './server.js'
}
};
const result = [
{
entry: './client.js'
},
{
entry: './server.js'
}
];

assert.deepEqual(merge(a, b), result);
});

it('should work with an array of objects', function () {
const a = {
client: {
Expand Down Expand Up @@ -109,6 +132,38 @@ function multipleTests(merge) {

assert.deepEqual(merge(a, b), result);
});

it('should merge where keys exist and add where not', function () {
const a = {
client: {
entry: './client.js'
},
server: {
entry: './server.js'
}
};
const b = {
server: {
entry: './replaced.js'
},
test: {
entry: './test.js'
}
};
const result = [
{
entry: './client.js'
},
{
entry: './replaced.js'
},
{
entry: './test.js'
}
];

assert.deepEqual(merge(a, b), result);
});
}

module.exports = multipleTests;

0 comments on commit f62d69f

Please sign in to comment.