Permalink
Browse files

test(): add mixpanel test back

  • Loading branch information...
1 parent 17f2fcb commit fd8f80e92b541f86ff04b662901db972d71c9032 @ihadeed ihadeed committed Oct 27, 2016
Showing with 28 additions and 0 deletions.
  1. +28 −0 test/plugins/mixpanel.spec.ts
@@ -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();
+ });
+
+});

0 comments on commit fd8f80e

Please sign in to comment.