Skip to content

Instantly share code, notes, and snippets.

@joshuaebowling
Last active September 2, 2015 00:42
Show Gist options
  • Save joshuaebowling/234a6705643a45ee24c3 to your computer and use it in GitHub Desktop.
Save joshuaebowling/234a6705643a45ee24c3 to your computer and use it in GitHub Desktop.
// Assuming Jasmine
// Assuming NAMESPACE is defined and is as id.js defines it.
describe('Test validity of my changes to id.js', function() {
beforeAll(function() {
// add some "id"s to the Array prototype
var self;
self = this;
self.testData = [
'joshuaebowling', 'posita'
];
});
it('Create an instance of NAMESPACE.id, check getId, close, and whether close removes instance\'s from the NAMESPACE._all_ids', function() {
var self, myPersona, myId;
self = this;
// yes, I'm joshuaebowling
myId = self.testData[0];
myPersona = NAMESPACE.id(myId);
expect(typeof myPersona).toBe('object');
expect(typeof myPersona.getId).toBe('function');
expect(typeof myPersona.close).toBe('function');
expect(myPersona.getId()).toBe(myId);
myPersona.close();
expect(NAMESPACE._all_ids[myPersona.getId()]).toBeUndefined();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment