Created
August 8, 2021 09:39
-
-
Save hhyyg/c4c6b5f384ece4d5c008fc292d0c461b to your computer and use it in GitHub Desktop.
Jasmine tests
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
const somethingPromise = (ms) => | |
new Promise((resolve) => setTimeout(resolve, ms)); | |
const somethingErrorPromise = (ms) => | |
new Promise((resolve) => { | |
throw new Error(); | |
}); | |
describe("test", () => { | |
it("test", async (done) => { | |
await somethingPromise(1000); | |
done(); | |
}); | |
it("test2", (done) => { | |
(async () => { | |
await somethingPromise(1000); | |
await somethingPromise(1000); | |
//done(); | |
})(); | |
}); | |
it("test3", async () => { | |
await somethingPromise(1000); | |
await somethingPromise(1000); | |
await expectAsync(somethingPromise(1000)).toBeRejectedWithError(); | |
await expectAsync(somethingErrorPromise(1000)).toBeRejected(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment