Ember-cli-jsmockito
Javascript Mocking and Matching Library for unit testing ember-cli applications.
Requirements
ember-cli >= 0.1.4
Installing
npm install ember-cli-jsmockito --save-dev
Add the following to tests/.jshintrc
inside the predef
array.
"mock",
"when",
"verify",
"mockFunction",
"spy",
"verifyZeroInteractions",
"verifyNoMoreInteractions",
"isMock",
"never",
"zeroInteractions",
"noMoreInteractions",
"times",
"once",
"empty",
"everyItem",
"hasItem",
"hasItems",
"hasSize",
"isIn",
"oneOf",
"allOf",
"anyOf",
"anything",
"both",
"either",
"equalTo",
"is",
"nil",
"not",
"raises",
"raisesAnything",
"sameAs",
"truth",
"equivalentMap",
"equivalentArray",
"between",
"closeTo",
"divisibleBy",
"even",
"greaterThan",
"greaterThanOrEqualTo",
"lessThan",
"lessThanOrEqualTo",
"notANumber",
"odd",
"zero",
"bool",
"func",
"hasFunction",
"hasMember",
"instanceOf",
"number",
"object",
"string",
"typeOf",
"containsString",
"emailAddress",
"endsWith",
"equalIgnoringCase",
"matches",
"startsWith"
Features
docs
Rich and readable matching api -;;;;;
docs
Mock any object -var modelMock = ;var controllerMock = ;
docs
Mock functions -var mockedFunc = ;
docs
Setup expectations on your mocks -var employeeMock = ;;;
docs
Verify function execution -var mockedFunc = ;;'hello world';
- Visit JsMockito for more information about mocking.
- Visit JsHamcrest for more information about the matching.