Sha256: 4b80e65e1f4ef7d61f6d8e014d8579aa40b69aed95b273aa1a2476be30a957d6

Contents?: true

Size: 1.32 KB

Versions: 74

Compression:

Stored size: 1.32 KB

Contents

var test = require("tape")
var extend = require("./")
var mutableExtend = require("./mutable")

test("merge", function(assert) {
    var a = { a: "foo" }
    var b = { b: "bar" }

    assert.deepEqual(extend(a, b), { a: "foo", b: "bar" })
    assert.end()
})

test("replace", function(assert) {
    var a = { a: "foo" }
    var b = { a: "bar" }

    assert.deepEqual(extend(a, b), { a: "bar" })
    assert.end()
})

test("undefined", function(assert) {
    var a = { a: undefined }
    var b = { b: "foo" }

    assert.deepEqual(extend(a, b), { a: undefined, b: "foo" })
    assert.deepEqual(extend(b, a), { a: undefined, b: "foo" })
    assert.end()
})

test("handle 0", function(assert) {
    var a = { a: "default" }
    var b = { a: 0 }

    assert.deepEqual(extend(a, b), { a: 0 })
    assert.deepEqual(extend(b, a), { a: "default" })
    assert.end()
})

test("is immutable", function (assert) {
    var record = {}

    extend(record, { foo: "bar" })
    assert.equal(record.foo, undefined)
    assert.end()
})

test("null as argument", function (assert) {
    var a = { foo: "bar" }
    var b = null
    var c = void 0

    assert.deepEqual(extend(b, a, c), { foo: "bar" })
    assert.end()
})

test("mutable", function (assert) {
    var a = { foo: "bar" }

    mutableExtend(a, { bar: "baz" })

    assert.equal(a.bar, "baz")
    assert.end()
})

Version data entries

74 entries across 35 versions & 7 rubygems

Version Path
webpack_rails-2.0.1 lib/webpack_rails/node_modules/xtend/test.js
webpack_rails-2.0.0 lib/webpack_rails/node_modules/xtend/test.js
es6_tilt-0.1.2 test/dummy/app/assets/javascripts/node_modules/xtend/test.js
es6_tilt-0.1.2 test/dummy/app/assets/javascripts/node_modules/fsevents/node_modules/node-pre-gyp/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/node_modules/xtend/test.js
es6_tilt-0.1.1 test/dummy/app/assets/javascripts/node_modules/fsevents/node_modules/node-pre-gyp/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/node_modules/xtend/test.js
es6_tilt-0.1.1 test/dummy/app/assets/javascripts/node_modules/xtend/test.js
es6_tilt-0.1.0 test/dummy/app/assets/javascripts/node_modules/fsevents/node_modules/node-pre-gyp/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/node_modules/xtend/test.js
es6_tilt-0.1.0 test/dummy/app/assets/javascripts/node_modules/xtend/test.js
webpack_rails-1.3.1 lib/webpack_rails/node_modules/xtend/test.js
node_task-0.3.5 lib/node_task/node_modules/ndjson/node_modules/through2/node_modules/xtend/test.js
node_task-0.3.4 lib/node_task/node_modules/ndjson/node_modules/through2/node_modules/xtend/test.js
node_task-0.3.3 lib/node_task/node_modules/ndjson/node_modules/through2/node_modules/xtend/test.js
webpack_rails-1.3.0 lib/webpack_rails/node_modules/xtend/test.js
node_task-0.3.2 lib/node_task/node_modules/ndjson/node_modules/through2/node_modules/xtend/test.js
node_task-0.3.1 lib/node_task/node_modules/ndjson/node_modules/through2/node_modules/xtend/test.js
node_task-0.3.0 lib/node_task/node_modules/ndjson/node_modules/through2/node_modules/xtend/test.js
webpack_rails-1.2.2 lib/webpack_rails/node_modules/xtend/test.js
webpack_rails-1.2.1 lib/webpack_rails/node_modules/xtend/test.js
webpack_rails-1.2.0 lib/webpack_rails/node_modules/xtend/test.js
webpack_rails-1.1.1 lib/webpack_rails/node_modules/xtend/test.js