Search code examples
javascripttddqunit

qunit test error with equal and deepEqual


I'm Trying to understand qunit testing

Why is this test failing? If I compare every property, are the same ...

    test("Get model equal", function () {

        function getModel() {

            function myModel() {
                this.name = "";
                this.address = "";
                this.phone = "";
            }

            return new myModel();
        }

        var model1 = getModel();
        var model2 = getModel();

        equal(model1, model2);

    });

    test("Get model deepEqual", function () {

        function getModel() {

            function myModel() {
                this.name = "";
                this.address = "";
                this.phone = "";
            }

            return new myModel();
        }

        var model1 = getModel();
        var model2 = getModel();

        deepEqual(model1, model2);

    });

Solution

  • https://forum.jquery.com/topic/why-deepequal-is-not-working-in-this-test#14737000002953407