blob: dffdf131067a3a5b487a783dbd2fce0aa2bc9d2e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
var foo = 1;
let bar = 2;
const baz = 3;
test("behavior of program-level var/let/const", () => {
expect(foo).toBe(1);
expect(bar).toBe(2);
expect(baz).toBe(3);
expect(globalThis.foo).toBe(1);
expect(globalThis.bar).toBeUndefined();
expect(globalThis.baz).toBeUndefined();
globalThis.foo = 4;
globalThis.bar = 5;
globalThis.baz = 6;
expect(foo).toBe(4);
expect(bar).toBe(2);
expect(baz).toBe(3);
expect(globalThis.foo).toBe(4);
expect(globalThis.bar).toBe(5);
expect(globalThis.baz).toBe(6);
});
|