2020-07-05 17:26:26 -07:00
|
|
|
// I'm not sure how this test passed before the refactor, but it definitely doesn't work at all
|
2020-07-05 10:47:40 -07:00
|
|
|
test.skip("reassignment to const", () => {
|
2020-07-06 07:37:45 -07:00
|
|
|
const constantValue = 1;
|
|
|
|
|
expect(() => {
|
|
|
|
|
constantValue = 2;
|
|
|
|
|
}).toThrowWithMessage(TypeError, "Invalid assignment to const variable");
|
|
|
|
|
expect(constantValue).toBe(1);
|
2020-07-05 10:47:40 -07:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test("const creation in inner scope", () => {
|
2020-07-06 07:37:45 -07:00
|
|
|
const constantValue = 1;
|
|
|
|
|
do {
|
|
|
|
|
const constantValue = 2;
|
|
|
|
|
expect(constantValue).toBe(2);
|
|
|
|
|
} while (false);
|
|
|
|
|
expect(constantValue).toBe(1);
|
2020-07-05 10:47:40 -07:00
|
|
|
});
|