@appium/test-support
v4.1.0
Published
A collection of test utilities used across Appium packages
Readme
@appium/test-support
⚠️ DEPRECATED: This module is deprecated. Use
sinondirectly instead (e.g.,sinon.createSandbox()with MochabeforeEach/afterEachhooks).
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
