blob: ada52e359f967785b4d9079082ddba11736f4739 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
"use strict";
test("basic functionality", () => {
[true, false, "foo", 123].forEach(primitive => {
expect(() => {
primitive.foo = "bar";
}).toThrowWithMessage(TypeError, "Cannot assign property foo to primitive value");
expect(() => {
primitive[Symbol.hasInstance] = 123;
}).toThrowWithMessage(
TypeError,
"Cannot assign property Symbol(Symbol.hasInstance) to primitive value"
);
});
});
|