Package Exports
- @appium/test-support
- @appium/test-support/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@appium/test-support) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@appium/test-support
A collection of test utility libs used across Appium packages
Installation
npm install @appium/test-support --save-devUsage
withSandbox
Use when mixing up sinon APIs (mocks, spies, stubs).
import { withSandbox } from '@appium/test-support';
let api = {
abc: () => { return 'abc'; }
};
describe('MyTest', withSandbox({mocks: {api}}, (S) => {
it('stubbing api, stubbing dog', () => {
S.mocks.api.expects('abc').once().returns('efg');
let dog = { bark: () => { return 'ouaf!'; } };
S.sandbox.stub(dog, 'bark').returns('miaou');
api.abc().should.equal('efg');
dog.bark().should.equal('miaou');
S.verify();
});
}));withMocks
When using mainly stubs.
import { withMocks } from '@appium/test-support';
let api = {
abc: () => { return 'abc'; }
};
describe('withMocks', withMocks({api}, (mocks) => {
it('should mock api', () => {
mocks.api.expects('abc').once().returns('efg');
api.abc().should.equal('efg');
mocks.verify();
});
}));License
Apache-2.0