mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-02-21 00:23:00 +08:00
test(): add mixpanel test back
This commit is contained in:
parent
17f2fcb829
commit
fd8f80e92b
28
test/plugins/mixpanel.spec.ts
Normal file
28
test/plugins/mixpanel.spec.ts
Normal file
@ -0,0 +1,28 @@
|
||||
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