<commit_before>"use strict";

var buster = require("buster");
var sinon = require("../lib/sinon");
var assert = buster.assert;

buster.testCase("sinon.extend", {
    "should return unaltered target when only one argument": function () {
        var target = { hello: "world" };

        sinon.extend(target);

        assert.equals(target, { hello: "world" });
    },

    "should copy all (own) properties into first argument, from all subsequent arguments": function () {
        var target = { hello: "world" };

        sinon.extend(target, { a: "a" }, { b: "b" });

        assert.equals(target.hello, "world");
        assert.equals(target.a, "a");
        assert.equals(target.b, "b");
    },

    "should copy toString method into target": function () {
        var target = {
            hello: "world",
            toString: function () {
                return "hello world";
            }
        };
        var source = {
            toString: function () {
                return "hello source";
            }
        };

        sinon.extend(target, source);

        assert.same(target.toString, source.toString);
    },

    "must copy the last occuring property into the target": function () {
        var target = { a: 0, b: 0, c: 0, d: 0 };
        var source1 = { a: 1, b: 1, c: 1 };
        var source2 = { a: 2, b: 2 };
        var source3 = { a: 3 };

        sinon.extend(target, source1, source2, source3);

        assert.equals(target.a, 3);
        assert.equals(target.b, 2);
        assert.equals(target.c, 1);
        assert.equals(target.d, 0);
    },

    "copies all properties": function () {
        var object1 = {
            prop1: null,
            prop2: false
        };

        var object2 = {
            prop3: "hey",
            prop4: 4
        };

        var result = sinon.extend({}, object1, object2);

        var expected = {
            prop1: null,
            prop2: false,
            prop3: "hey",
            prop4: 4
        };

        assert.equals(result, expected);
    }
});<commit_msg>Convert extend tests to mocha<commit_after>/*eslint-env mocha*/
"use strict";

var referee = require("referee");
var sinon = require("../lib/sinon");
var assert = referee.assert;

describe("sinon.extend", function () {
    it("should return unaltered target when only one argument", function () {
        var target = { hello: "world" };

        sinon.extend(target);

        assert.equals(target, { hello: "world" });
    });

    it("should copy all (own) properties into first argument, from all subsequent arguments", function () {
        var target = { hello: "world" };

        sinon.extend(target, { a: "a" }, { b: "b" });

        assert.equals(target.hello, "world");
        assert.equals(target.a, "a");
        assert.equals(target.b, "b");
    });

    it("should copy toString method into target", function () {
        var target = {
            hello: "world",
            toString: function () {
                return "hello world";
            }
        };
        var source = {
            toString: function () {
                return "hello source";
            }
        };

        sinon.extend(target, source);

        assert.same(target.toString, source.toString);
    });

    it("must copy the last occuring property into the target", function () {
        var target = { a: 0, b: 0, c: 0, d: 0 };
        var source1 = { a: 1, b: 1, c: 1 };
        var source2 = { a: 2, b: 2 };
        var source3 = { a: 3 };

        sinon.extend(target, source1, source2, source3);

        assert.equals(target.a, 3);
        assert.equals(target.b, 2);
        assert.equals(target.c, 1);
        assert.equals(target.d, 0);
    });

    it("copies all properties", function () {
        var object1 = {
            prop1: null,
            prop2: false
        };

        var object2 = {
            prop3: "hey",
            prop4: 4
        };

        var result = sinon.extend({}, object1, object2);

        var expected = {
            prop1: null,
            prop2: false,
            prop3: "hey",
            prop4: 4
        };

        assert.equals(result, expected);
    });
});
{'fraction_non_alphanumeric': 0.14357622243528284, 'fraction_numerical': 0.016299137104506232, 'mean_word_length': 1.7363934426229508, 'pattern_counts': {'":': 5, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5659795', 'n_tokens_mistral': 1286, 'n_tokens_neox': 1205, 'n_words': 341}