2020-05-28 17:48:25 +01:00
|
|
|
"use strict";
|
|
|
|
|
2023-08-09 15:14:05 -04:00
|
|
|
test.xfail("basic functionality", () => {
|
2020-07-06 07:37:45 -07:00
|
|
|
[true, false, "foo", 123].forEach(primitive => {
|
|
|
|
expect(() => {
|
|
|
|
primitive.foo = "bar";
|
2021-09-22 12:44:56 +02:00
|
|
|
}).toThrowWithMessage(TypeError, `Cannot set property 'foo' of ${primitive}`);
|
2021-04-02 21:00:37 +02:00
|
|
|
expect(() => {
|
|
|
|
primitive[Symbol.hasInstance] = 123;
|
|
|
|
}).toThrowWithMessage(
|
|
|
|
TypeError,
|
2021-09-22 12:44:56 +02:00
|
|
|
`Cannot set property 'Symbol(Symbol.hasInstance)' of ${primitive}`
|
2021-04-02 21:00:37 +02:00
|
|
|
);
|
|
|
|
});
|
|
|
|
[null, undefined].forEach(primitive => {
|
|
|
|
expect(() => {
|
|
|
|
primitive.foo = "bar";
|
2021-06-25 16:27:59 +02:00
|
|
|
}).toThrowWithMessage(TypeError, `${primitive} cannot be converted to an object`);
|
2020-11-12 10:32:46 +00:00
|
|
|
expect(() => {
|
|
|
|
primitive[Symbol.hasInstance] = 123;
|
2021-06-25 16:27:59 +02:00
|
|
|
}).toThrowWithMessage(TypeError, `${primitive} cannot be converted to an object`);
|
2020-07-06 07:37:45 -07:00
|
|
|
});
|
2020-07-05 10:47:40 -07:00
|
|
|
});
|