This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| it('it should throw an exception', function () { | |
| expect(throwsError).toThrow(); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function throwsError() { | |
| throw new TypeError("A type error"); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| xdescribe("Math Utils", function() { | |
| /* ... */ | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| xdescribe("Math Utils", function() { | |
| /* ... */ | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| describe("/Async Op", function () { | |
| var asyncOpCompleted = false; | |
| beforeEach(function (done) { | |
| utils.simulateAsyncOp().then(()=>{ | |
| asyncOpCompleted = true; | |
| done(); | |
| }); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| describe("/Async Op", function () { | |
| var asyncOpCompleted = false; | |
| beforeEach(function (done) { | |
| utils.simulateAsyncOp().then(()=>{ | |
| asyncOpCompleted = true; | |
| done(); | |
| }); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| beforeEach(function () { | |
| jasmine.clock().install(); | |
| }); | |
| afterEach(function() { | |
| jasmine.clock().uninstall(); | |
| }); | |
| it("should call the asynchronous operation synchronously", function() { | |
| var completed = false; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function simulateAsyncOp(callback){ | |
| setTimeout(function () { | |
| callback(); | |
| }, 1000); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function simulateAsyncOp(callback){ | |
| setTimeout(function () { | |
| callback(); | |
| }, 1000); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| it("should work with async/await", async () => { | |
| let completed = false; | |
| completed = await utils.simulateAsyncOp2(); | |
| expect(completed).toEqual(true); | |
| }); |