Wednesday 15 April 2015

javascript - single mock of object in nested describe functions (jasmine -


After

If I have a jasmine imagery with the descriptions of nested, and I want to keep a detective on a method, it A specific result for return, once what is the correct approach in all the ways? I know that I can only define the spying in the top level method, though, does that mean that some of my tests only get the same thing?

So, if I have something like this:

  Description (i) do not want to retain from one trial to another, even if this code reuse allows for. 'Tope level test', function () {var FOO; BeforeEach (module ('FooBar')); BeforeEach (Inject (function (_Foo _) {foo = _Foo_ ;. FOO.bar = jasmine.createSpy ('foobar') andReturn ("baz");})); Description ('function A') {if ('sub1', function () {FOO.newMethod = function} {'this should not exist'};}); if ('all 2', function ( ) {FOO.newMethod ();});})]);  

I would think that all 2 new methods will be able to use because sub-1 defines it and that it was first determined that FOO began functioning at A, but FOO only, so sub 1 and all 2 have shared the same FOOI is it right?

Believe it's true how I can add a detective to the very top level of the description, while also ensuring that the item is fresh, which is used every time a test match is generated Every time with the desired spy, every time

use object.create () New instance of the object To create:

) (formerly ( 

No comments:

Post a Comment