使用equal和deepEqual进行qunit测试错误 [英] qunit test error with equal and deepEqual

查看:42
本文介绍了使用equal和deepEqual进行qunit测试错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试了解 qunit 测试

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);

    });

推荐答案

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

这篇关于使用equal和deepEqual进行qunit测试错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆