Jasmine testing async calls (doesn't work)

Uses Jasmine 3.5

by Joe Wilson

HTML

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jasmine/3.5.0/jasmine.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jasmine/3.5.0/jasmine.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jasmine/3.5.0/jasmine-html.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jasmine/3.5.0/boot.min.js"></script>

JavaScript

// Code under test
var flag = false;

function testAsync(done) {
    // Wait two seconds, then set the flag to true
    setTimeout(function () {
        flag = true;
    }, 2000);
}

// Specs
describe("Testing async calls", function () {
    
    it("Should be true if the async call has completed", function () {
        expect(flag).toEqual(true);
    });

});