Namespace goog.testing
code »Interfaces
|
Classes
|
Global Functions
code »goog.testing.FunctionMock ( opt_functionName, opt_strictness ) ⇒ goog.testing.MockInterfaceClass used to mock a function. Useful for mocking closures and anonymous
callbacks etc. Creates a function object that extends goog.testing.Mock.
goog.testing.MockInterfacecode »goog.testing.GlobalFunctionMock ( functionName, opt_strictness ) ⇒ !goog.testing.MockInterfaceMocks a global / top-level function. Creates a goog.testing.MethodMock
in the global scope with the name specified by functionName.
!goog.testing.MockInterfacecode »goog.testing.MethodMock ( scope, functionName, opt_strictness ) ⇒ !goog.testing.MockInterfaceMocks an existing function. Creates a goog.testing.FunctionMock
and registers it in the given scope with the name specified by functionName.
!goog.testing.MockInterfacecode »goog.testing.createConstructorMock ( scope, constructorName, opt_strictness ) ⇒ !goog.testing.MockInterfaceConvenience method for creating a mock for a constructor. Copies class
members to the mock.
When mocking a constructor to return a mocked instance, remember to create
the instance mock before mocking the constructor. If you mock the constructor
first, then the mock framework will be unable to examine the prototype chain
when creating the mock instance.
!goog.testing.MockInterfacecode »goog.testing.createFunctionMock ( opt_functionName, opt_strictness ) ⇒ goog.testing.MockInterfaceConvenience method for creating a mock for a function.
goog.testing.MockInterfacecode »goog.testing.createGlobalFunctionMock ( functionName, opt_strictness ) ⇒ goog.testing.MockInterfaceConvenience method for creating a mocks for a global / top-level function.
goog.testing.MockInterfacecode »goog.testing.createMethodMock ( scope, functionName, opt_strictness ) ⇒ !goog.testing.MockInterfaceConvenience method for creating a mock for a method.
!goog.testing.MockInterfacecode »goog.testing.recordConstructor ( ctor ) ⇒ !FunctionSame as goog.testing.recordFunction but the recorded function will
have the same prototype and static fields as the original one. It can be
used with constructors.
!Functiongoog.testing.recordFunction but the recorded function will
have the same prototype and static fields as the original one. It can be
used with constructors.| Parameters |
|---|
|
| Returns |
|
code »goog.testing.recordFunction ( opt_f ) ⇒ !FunctionWraps the function into another one which calls the inner function and
records its calls. The recorded function will have 3 static methods:
getCallCount, getCalls and getLastCall but won't
inherit the original function's prototype and static fields.
!FunctiongetCallCount, getCalls and getLastCall but won't
inherit the original function's prototype and static fields.| Parameters |
|---|
|
| Returns |
|