Ember-aupac-mocks
Javascript Mocking and Matching Library for unit testing ember-cli applications.
Requirements
ember-cli >= 1.13.x
Installing
ember install ember-aupac-mocks
Usage
Import the Mocks and Matchers into your ember test.
; //Use object deconstruction to pull out the features you want to useconst mock mockFunction verify when ...more = Mocks;const empty emailAddress greaterThan everyItem hasSize even lessThan either ...more = Matchers; //Start mocking and matching in your tests;
Features
docs
Rich and readable matching api -;;;;;
docs
Mock any object -var modelMock = ;var controllerMock = ;
docs
Setup expectations on your mocks -var employeeMock = ;;;
docs
Verify function execution -var employeeMock = ;employeeMock;;
docs
Mock functions -var mockedFunc = ;
docs
Verify function execution -var mockedFunc = ;;'hello world';
- Visit JsMockito for more information about mocking.
- Visit JsHamcrest for more information about the matching.
docs
Mocks -const mock when verify mockFunction spy verifyZeroInteractions verifyNoMoreInteractions isMock never zeroInteractions noMoreInteractions times once } = Mocks;
docs
Matchers -const assertThat 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 filter callTo } = Matchers;
Installation
git clone
this repositorynpm install
bower install
Running
ember server
- Visit your app at http://localhost:4200.
Running Tests
ember test
ember test --server
Building
ember build
For more information on using ember-cli, visit http://www.ember-cli.com/.