blob: f3364074350b3d7e8b58763ea10e030eee2832b7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
test("reassignment to const", () => {
const constantValue = 1;
expect(() => {
constantValue = 2;
}).toThrowWithMessage(TypeError, "Invalid assignment to const variable");
expect(constantValue).toBe(1);
});
test("const creation in inner scope", () => {
const constantValue = 1;
do {
const constantValue = 2;
expect(constantValue).toBe(2);
} while (false);
expect(constantValue).toBe(1);
});
|