2020-07-05 10:47:40 -07:00
|
|
|
test("basic functionality", () => {
|
2020-07-06 07:37:45 -07:00
|
|
|
const o = {};
|
|
|
|
|
o.a = 1;
|
2020-03-28 11:48:52 +01:00
|
|
|
|
2020-07-06 07:37:45 -07:00
|
|
|
expect(o.a === 1).toBeTrue();
|
|
|
|
|
expect(!o.a === false).toBeTrue();
|
|
|
|
|
expect(!o.a === !o.a).toBeTrue();
|
|
|
|
|
expect(~o.a === ~o.a).toBeTrue();
|
|
|
|
|
expect(+o.a === +o.a).toBeTrue();
|
|
|
|
|
expect(-o.a === -o.a).toBeTrue();
|
2020-03-28 11:48:52 +01:00
|
|
|
|
2020-07-06 07:37:45 -07:00
|
|
|
expect((typeof "x" === "string") === true).toBeTrue();
|
|
|
|
|
expect(!(typeof "x" === "string") === false).toBeTrue();
|
2020-07-05 10:47:40 -07:00
|
|
|
});
|
2023-08-07 21:38:46 -05:00
|
|
|
|
|
|
|
|
test("unary +/- operators bind higher than binary", () => {
|
|
|
|
|
expect(10 ** -3 / 2).toEqual(0.0005);
|
|
|
|
|
});
|