简体   繁体   English

如何在余烬单元测试中模拟_super()方法

[英]How to mock _super() method in ember unit test

I am writing Unit test for route. 我正在编写路线的单元测试。 I have two route one is parent and other is child both contains model() function(hook). 我有两个路由,一个是父级,另一个是子级,都包含model()function(hook)。 When i am writing a child route test cases there is a call for parent model funvtion via this._super().ie 当我编写子路由测试用例时,通过this._super()。ie调用了父模型功能

model: function (model) {
....
        this._super(model);
}

Is there any way to mock this super(model function) in unit test to prevent it. 有什么方法可以在单元测试中模拟此super(model function)来防止它。

This is not possible. 这是不可能的。 See Github issue below for more info. 有关更多信息,请参见下面的Github问题。

https://github.com/emberjs/ember.js/issues/12457 https://github.com/emberjs/ember.js/issues/12457

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM