1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
|
// SPDX-License-Identifier: MIT OR LGPL-2.0-or-later
// SPDX-FileCopyrightText: 2008 litl, LLC
describe('Test harness internal consistency', function () {
it('', function () {
var someUndefined;
var someNumber = 1;
var someOtherNumber = 42;
var someString = 'hello';
var someOtherString = 'world';
expect(true).toBeTruthy();
expect(false).toBeFalsy();
expect(someNumber).toEqual(someNumber);
expect(someString).toEqual(someString);
expect(someNumber).not.toEqual(someOtherNumber);
expect(someString).not.toEqual(someOtherString);
expect(null).toBeNull();
expect(someNumber).not.toBeNull();
expect(someNumber).toBeDefined();
expect(someUndefined).not.toBeDefined();
expect(0 / 0).toBeNaN();
expect(someNumber).not.toBeNaN();
expect(() => {
throw new Error();
}).toThrow();
expect(() => expect(true).toThrow()).toThrow();
expect(() => true).not.toThrow();
});
describe('awaiting', function () {
it('a Promise resolves', async function () {
await Promise.resolve();
expect(true).toBe(true);
});
async function nested() {
await Promise.resolve();
}
it('a nested async function resolves', async function () {
await nested();
expect(true).toBe(true);
});
});
});
describe('SpiderMonkey features check', function () {
it('Intl API was compiled into SpiderMonkey', function () {
expect(Intl).toBeDefined();
});
it('WeakRef is enabled', function () {
expect(WeakRef).toBeDefined();
});
it('class static blocks are enabled', function () {
class Test {
static {
Test.x = 4;
}
}
expect(Test.x).toBe(4);
});
});
|