Skip to content

Instantly share code, notes, and snippets.

@jzerbe
Created March 22, 2015 17:30
Show Gist options
  • Save jzerbe/1a14bec710e21fb6956a to your computer and use it in GitHub Desktop.
Save jzerbe/1a14bec710e21fb6956a to your computer and use it in GitHub Desktop.
async Jasmine spec file example in typescript
/// <reference path="../../api/jasmine/jasmine.d.ts" />
/// <reference path="../../src/Task/CoolThing.ts" />
describe("CoolThingTest", function() {
var RESOURCE_ID:string = 'agdiaWctc2t5ch4LEhFTZWxlY3Rpb25SZXNvdXJjZRiAgICAgICgCgw';
beforeEach(function(done) {
this.testTask = new Task.CoolThing(RESOURCE_ID);
expect(this.testTask.run()).toBe(true);
this.testTask.callbackComplete = function (eventObj):void {
done();
};
this.testTask.callbackError = function (eventObj):void {
done();
};
});
it('should get a thing after the async call', function() {
var expUrl:string = '/api/v1.0/namespace/service/model/' + RESOURCE_ID;
expect(this.testTask.endpointUrlStr).toBe(expUrl);
expect(this.testTask.responseJSON).not.toBe(null);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment