You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
606 B
28 lines
606 B
describe("sample", function(){
|
|
|
|
it("should return testdata", function(){
|
|
expect(testfunc()).toEqual('testdata');
|
|
});
|
|
|
|
|
|
it("checks that async / await works", async() => {
|
|
function asyncFunctionSample(x) {
|
|
return new Promise(
|
|
resolve => {
|
|
setTimeout(()=> {resolve(x);}, 3000);
|
|
}
|
|
);
|
|
}
|
|
|
|
async function check(x) {
|
|
var retval = asyncFunctionSample(10);
|
|
return x + await retval;
|
|
}
|
|
|
|
var v = await check(10);
|
|
expect(v).toBe(20);
|
|
|
|
|
|
});
|
|
|
|
});
|