mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-01-31 10:36:14 +08:00
test(): fix tests
This commit is contained in:
parent
24752652b7
commit
0388ac3f6b
@ -22,6 +22,7 @@ module.exports = config => {
|
||||
},
|
||||
|
||||
browserify: {
|
||||
debug: true,
|
||||
plugin: [ 'tsify' ],
|
||||
extensions: ['.js', '.ts']
|
||||
},
|
||||
|
@ -3,7 +3,7 @@
|
||||
import 'es6-shim';
|
||||
import {Plugin, Cordova} from './../src/plugins/plugin';
|
||||
|
||||
declare const window: any;
|
||||
declare let window: any;
|
||||
window.plugins = {
|
||||
test: {}
|
||||
};
|
||||
|
@ -1,28 +0,0 @@
|
||||
import {Mixpanel} from '../../src/plugins/mixpanel';
|
||||
declare const window: any;
|
||||
|
||||
window.mixpanel = {
|
||||
people: {
|
||||
identify: (args, success, error) => success('Success')
|
||||
}
|
||||
};
|
||||
|
||||
describe('Mixpanel', () => {
|
||||
|
||||
it('should return MixpanelPeople', () => {
|
||||
expect(Mixpanel.people).toBeDefined();
|
||||
expect(Mixpanel.people.identify).toBeDefined();
|
||||
});
|
||||
|
||||
it('should call a method of MixpanelPeople', (done) => {
|
||||
const spy = spyOn(window.mixpanel.people, 'identify').and.callThrough();
|
||||
Mixpanel.people.identify('veryDistinctSuchIdVeryWow')
|
||||
.then(result => {
|
||||
expect(result).toEqual('Success');
|
||||
done();
|
||||
});
|
||||
expect(spy.calls.mostRecent().args[0]).toEqual('veryDistinctSuchIdVeryWow');
|
||||
expect(window.mixpanel.people.identify).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
});
|
Loading…
Reference in New Issue
Block a user