Skip to content

Instantly share code, notes, and snippets.

@BlackVegetable
Created June 26, 2015 17:21
Show Gist options
  • Save BlackVegetable/7e12a0c3d13bea4b0091 to your computer and use it in GitHub Desktop.
Save BlackVegetable/7e12a0c3d13bea4b0091 to your computer and use it in GitHub Desktop.
1) Keen IO "after each" hook: TypeError: '[object Object]' is not a function (evaluating 'this.traits({})')
it('should always refresh global properties with user traits if present', function() {
var id = 'Devon Higgins';
var traits = { trait: 'Pretty Neat', id: id };
analytics.user().userId = id;
analytics.user().traits = traits;
// Notice no identify() call is made here.
// This is to emulate a page reload which loses the global
// properties that identify() saves.
analytics.track('event');
var global_user = keen.client.client.globalProperties().user;
analytics.deepEqual(global_user, { userId: id, traits: traits });
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment