Skip to content

Instantly share code, notes, and snippets.

View techiediaries's full-sized avatar

Techiediaries (Now 10xdev.blog) techiediaries

View GitHub Profile
it('it should throw an exception', function () {
expect(throwsError).toThrow();
});
function throwsError() {
throw new TypeError("A type error");
}
xdescribe("Math Utils", function() {
/* ... */
});
xdescribe("Math Utils", function() {
/* ... */
});
describe("/Async Op", function () {
var asyncOpCompleted = false;
beforeEach(function (done) {
utils.simulateAsyncOp().then(()=>{
asyncOpCompleted = true;
done();
});
});
describe("/Async Op", function () {
var asyncOpCompleted = false;
beforeEach(function (done) {
utils.simulateAsyncOp().then(()=>{
asyncOpCompleted = true;
done();
});
});
beforeEach(function () {
jasmine.clock().install();
});
afterEach(function() {
jasmine.clock().uninstall();
});
it("should call the asynchronous operation synchronously", function() {
var completed = false;
function simulateAsyncOp(callback){
setTimeout(function () {
callback();
}, 1000);
}
function simulateAsyncOp(callback){
setTimeout(function () {
callback();
}, 1000);
}
it("should work with async/await", async () => {
let completed = false;
completed = await utils.simulateAsyncOp2();
expect(completed).toEqual(true);
});