Merge pull request #7579 from devenbansod/migrate-to-jest-expect-2
Migrate a few packages' tests to use Jest Expect (see below)
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
import annotateAsPure from "../";
|
||||
import assert from "assert";
|
||||
|
||||
describe("@babel/helper-annotate-as-pure", () => {
|
||||
it("will add leading comment", () => {
|
||||
const node = {};
|
||||
annotateAsPure(node);
|
||||
|
||||
assert.deepEqual(node.leadingComments, [
|
||||
expect(node.leadingComments).toEqual([
|
||||
{
|
||||
type: "CommentBlock",
|
||||
value: "#__PURE__",
|
||||
@@ -26,7 +25,7 @@ describe("@babel/helper-annotate-as-pure", () => {
|
||||
|
||||
annotateAsPure(node);
|
||||
|
||||
assert.deepEqual(node.leadingComments, [
|
||||
expect(node.leadingComments).toEqual([
|
||||
{
|
||||
type: "CommentBlock",
|
||||
value: "#__PURE__",
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import chai from "chai";
|
||||
import * as babel from "@babel/core";
|
||||
|
||||
import { ImportInjector } from "../";
|
||||
@@ -33,9 +32,9 @@ function test(sourceType, opts, initializer, expectedCode) {
|
||||
],
|
||||
});
|
||||
|
||||
chai
|
||||
.expect(result.code.replace(/\s+/g, " ").trim())
|
||||
.to.equal((expectedCode || "").replace(/\s+/g, " ").trim());
|
||||
expect(result.code.replace(/\s+/g, " ").trim()).toBe(
|
||||
(expectedCode || "").replace(/\s+/g, " ").trim(),
|
||||
);
|
||||
}
|
||||
const testScript = test.bind(undefined, "script");
|
||||
const testModule = test.bind(undefined, "module");
|
||||
@@ -90,11 +89,9 @@ describe("@babel/helper-module-imports", () => {
|
||||
|
||||
describe("using a CommonJS loader", () => {
|
||||
it("should import", () => {
|
||||
chai
|
||||
.expect(() => {
|
||||
testScript({ importedType }, addNamespace());
|
||||
})
|
||||
.to.throw(Error, "Cannot import an ES6 module from CommonJS");
|
||||
expect(() => {
|
||||
testScript({ importedType }, addNamespace());
|
||||
}).toThrow("Cannot import an ES6 module from CommonJS");
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -302,11 +299,9 @@ describe("@babel/helper-module-imports", () => {
|
||||
|
||||
describe("using a CommonJS loader", () => {
|
||||
it("should import", () => {
|
||||
chai
|
||||
.expect(() => {
|
||||
testScript({ importedType }, addDefault());
|
||||
})
|
||||
.to.throw(Error, "Cannot import an ES6 module from CommonJS");
|
||||
expect(() => {
|
||||
testScript({ importedType }, addDefault());
|
||||
}).toThrow("Cannot import an ES6 module from CommonJS");
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -390,14 +385,12 @@ describe("@babel/helper-module-imports", () => {
|
||||
});
|
||||
|
||||
it("should fail to import with force-enabled liveness", () => {
|
||||
chai
|
||||
.expect(() => {
|
||||
testScript(
|
||||
{ importedInterop, ensureLiveReference: true },
|
||||
addDefault(),
|
||||
);
|
||||
})
|
||||
.to.throw(Error, "No live reference for commonjs default");
|
||||
expect(() => {
|
||||
testScript(
|
||||
{ importedInterop, ensureLiveReference: true },
|
||||
addDefault(),
|
||||
);
|
||||
}).toThrow("No live reference for commonjs default");
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -659,11 +652,9 @@ describe("@babel/helper-module-imports", () => {
|
||||
|
||||
describe("using a CommonJS loader", () => {
|
||||
it("should import", () => {
|
||||
chai
|
||||
.expect(() => {
|
||||
testScript({ importedType }, addNamed());
|
||||
})
|
||||
.to.throw(Error, "Cannot import an ES6 module from CommonJS");
|
||||
expect(() => {
|
||||
testScript({ importedType }, addNamed());
|
||||
}).toThrow("Cannot import an ES6 module from CommonJS");
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -967,11 +958,9 @@ describe("@babel/helper-module-imports", () => {
|
||||
|
||||
describe("using a CommonJS loader", () => {
|
||||
it("should import", () => {
|
||||
chai
|
||||
.expect(() => {
|
||||
testScript({ importedType }, addSideEffect());
|
||||
})
|
||||
.to.throw(Error, "Cannot import an ES6 module from CommonJS");
|
||||
expect(() => {
|
||||
testScript({ importedType }, addSideEffect());
|
||||
}).toThrow("Cannot import an ES6 module from CommonJS");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,15 +1,7 @@
|
||||
import assert from "assert";
|
||||
|
||||
export function assertNoOwnProperties(obj) {
|
||||
assert.equal(Object.getOwnPropertyNames(obj).length, 0);
|
||||
expect(Object.getOwnPropertyNames(obj)).toHaveLength(0);
|
||||
}
|
||||
|
||||
export function assertHasOwnProperty() {}
|
||||
|
||||
export function assertLacksOwnProperty() {}
|
||||
|
||||
export function multiline(arr) {
|
||||
return arr.join("\n");
|
||||
}
|
||||
|
||||
export const assertArrayEquals = assert.deepEqual;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import assert from "assert";
|
||||
import { runCodeInTestContext } from "..";
|
||||
|
||||
describe("helper-transform-fixture-test-runner", function() {
|
||||
@@ -6,13 +5,13 @@ describe("helper-transform-fixture-test-runner", function() {
|
||||
try {
|
||||
global.foo = "outer";
|
||||
runCodeInTestContext(`
|
||||
assert.equal(global.foo, undefined);
|
||||
expect(global.foo).toBeUndefined();
|
||||
global.foo = "inner";
|
||||
`);
|
||||
|
||||
assert.equal(global.foo, "outer");
|
||||
expect(global.foo).toBe("outer");
|
||||
runCodeInTestContext(`
|
||||
assert.equal(global.foo, "inner");
|
||||
expect(global.foo).toBe("inner");
|
||||
`);
|
||||
} finally {
|
||||
delete global.foo;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import assert from "assert";
|
||||
import chalk from "chalk";
|
||||
import stripAnsi from "strip-ansi";
|
||||
import highlight, { shouldHighlight, getChalk } from "..";
|
||||
@@ -24,8 +23,8 @@ describe("@babel/highlight", function() {
|
||||
const code = "console.log('hi')";
|
||||
const result = highlight(code);
|
||||
const stripped = stripAnsi(result);
|
||||
assert.ok(result.length > stripped.length);
|
||||
assert.equal(stripped, code);
|
||||
expect(result.length).toBeGreaterThan(stripped.length);
|
||||
expect(stripped).toBe(code);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -36,8 +35,8 @@ describe("@babel/highlight", function() {
|
||||
const code = "console.log('hi')";
|
||||
const result = highlight(code);
|
||||
const stripped = stripAnsi(result);
|
||||
assert.ok(result.length === stripped.length);
|
||||
assert.equal(result, code);
|
||||
expect(result.length).toBe(stripped.length);
|
||||
expect(result).toBe(code);
|
||||
});
|
||||
|
||||
describe("and the forceColor option is passed", function() {
|
||||
@@ -45,8 +44,8 @@ describe("@babel/highlight", function() {
|
||||
const code = "console.log('hi')";
|
||||
const result = highlight(code, { forceColor: true });
|
||||
const stripped = stripAnsi(result);
|
||||
assert.ok(result.length > stripped.length);
|
||||
assert.equal(stripped, code);
|
||||
expect(result.length).toBeGreaterThan(stripped.length);
|
||||
expect(stripped).toBe(code);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -57,7 +56,7 @@ describe("@babel/highlight", function() {
|
||||
stubColorSupport(true);
|
||||
|
||||
it("returns true", function() {
|
||||
assert.ok(shouldHighlight({}));
|
||||
expect(shouldHighlight({})).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -65,12 +64,12 @@ describe("@babel/highlight", function() {
|
||||
stubColorSupport(false);
|
||||
|
||||
it("returns false", function() {
|
||||
assert.ok(!shouldHighlight({}));
|
||||
expect(shouldHighlight({})).toBeFalsy();
|
||||
});
|
||||
|
||||
describe("and the forceColor option is passed", function() {
|
||||
it("returns true", function() {
|
||||
assert.ok(shouldHighlight({ forceColor: true }));
|
||||
expect(shouldHighlight({ forceColor: true })).toBeTruthy();
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -82,14 +81,13 @@ describe("@babel/highlight", function() {
|
||||
|
||||
describe("when forceColor is not passed", function() {
|
||||
it("returns a Chalk instance", function() {
|
||||
assert.equal(getChalk({}).constructor, chalk.constructor);
|
||||
expect(getChalk({}).constructor).toBe(chalk.constructor);
|
||||
});
|
||||
});
|
||||
|
||||
describe("when forceColor is passed", function() {
|
||||
it("returns a Chalk instance", function() {
|
||||
assert.equal(
|
||||
getChalk({ forceColor: true }).constructor,
|
||||
expect(getChalk({ forceColor: true }).constructor).toBe(
|
||||
chalk.constructor,
|
||||
);
|
||||
});
|
||||
@@ -101,14 +99,13 @@ describe("@babel/highlight", function() {
|
||||
|
||||
describe("when forceColor is not passed", function() {
|
||||
it("returns a Chalk instance", function() {
|
||||
assert.equal(getChalk({}).constructor, chalk.constructor);
|
||||
expect(getChalk({}).constructor).toBe(chalk.constructor);
|
||||
});
|
||||
});
|
||||
|
||||
describe("when forceColor is passed", function() {
|
||||
it("returns a Chalk instance", function() {
|
||||
assert.equal(
|
||||
getChalk({ forceColor: true }).constructor,
|
||||
expect(getChalk({ forceColor: true }).constructor).toBe(
|
||||
chalk.constructor,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
const includes = require("lodash/includes");
|
||||
const readdir = require("fs-readdir-recursive");
|
||||
const helper = require("@babel/helper-fixtures");
|
||||
const assert = require("assert");
|
||||
const rimraf = require("rimraf");
|
||||
const outputFileSync = require("output-file-sync");
|
||||
const child = require("child_process");
|
||||
const merge = require("lodash/merge");
|
||||
const path = require("path");
|
||||
const chai = require("chai");
|
||||
const fs = require("fs");
|
||||
|
||||
const fixtureLoc = path.join(__dirname, "fixtures");
|
||||
@@ -53,15 +51,9 @@ const assertTest = function(stdout, stderr, opts) {
|
||||
|
||||
if (opts.stderr) {
|
||||
if (opts.stderrContains) {
|
||||
assert.ok(
|
||||
includes(stderr, expectStderr),
|
||||
"stderr " +
|
||||
JSON.stringify(stderr) +
|
||||
" didn't contain " +
|
||||
JSON.stringify(expectStderr),
|
||||
);
|
||||
expect(includes(stderr, expectStderr)).toBeTruthy();
|
||||
} else {
|
||||
chai.expect(stderr).to.equal(expectStderr, "stderr didn't match");
|
||||
expect(stderr).toBe(expectStderr);
|
||||
}
|
||||
} else if (stderr) {
|
||||
throw new Error("stderr:\n" + stderr + "\n\nstdout:\n" + stdout);
|
||||
@@ -73,15 +65,9 @@ const assertTest = function(stdout, stderr, opts) {
|
||||
|
||||
if (opts.stdout) {
|
||||
if (opts.stdoutContains) {
|
||||
assert.ok(
|
||||
includes(stdout, expectStdout),
|
||||
"stdout " +
|
||||
JSON.stringify(stdout) +
|
||||
" didn't contain " +
|
||||
JSON.stringify(expectStdout),
|
||||
);
|
||||
expect(includes(stdout, expectStdout)).toBeTruthy();
|
||||
} else {
|
||||
chai.expect(stdout).to.equal(expectStdout, "stdout didn't match");
|
||||
expect(stdout).toBe(expectStdout);
|
||||
}
|
||||
} else if (stdout) {
|
||||
throw new Error("stdout:\n" + stdout);
|
||||
@@ -92,24 +78,19 @@ const assertTest = function(stdout, stderr, opts) {
|
||||
|
||||
Object.keys(actualFiles).forEach(function(filename) {
|
||||
if (!opts.inFiles.hasOwnProperty(filename)) {
|
||||
const expect = opts.outFiles[filename];
|
||||
const expected = opts.outFiles[filename];
|
||||
const actual = actualFiles[filename];
|
||||
|
||||
chai.expect(expect, "Output is missing: " + filename).to.not.be
|
||||
.undefined;
|
||||
expect(expected).not.toBeUndefined();
|
||||
|
||||
if (expect) {
|
||||
chai
|
||||
.expect(actual)
|
||||
.to.equal(expect, "Compiled output does not match: " + filename);
|
||||
if (expected) {
|
||||
expect(actual).toBe(expected);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Object.keys(opts.outFiles).forEach(function(filename) {
|
||||
chai
|
||||
.expect(actualFiles, "Extraneous file in output: " + filename)
|
||||
.to.contain.key(filename);
|
||||
expect(actualFiles).toHaveProperty(filename);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -20,5 +20,5 @@ async function main() {
|
||||
}
|
||||
|
||||
return main().then(() => {
|
||||
assert.deepEqual(actual, expected);
|
||||
expect(actual).toEqual(expected);
|
||||
});
|
||||
|
||||
@@ -20,5 +20,5 @@ async function main() {
|
||||
}
|
||||
|
||||
return main().then(() => {
|
||||
assert.deepEqual(actual, expected);
|
||||
expect(actual).toEqual(expected);
|
||||
});
|
||||
|
||||
@@ -21,6 +21,6 @@ function forEach(ai, fn) {
|
||||
var output = 0;
|
||||
return forEach(genAnswers(), function(val) { output += val.value })
|
||||
.then(function () {
|
||||
assert.equal(output, 42);
|
||||
expect(output).toBe(42);
|
||||
});
|
||||
|
||||
|
||||
@@ -24,15 +24,15 @@ class MyClass {
|
||||
const inst = new MyClass();
|
||||
|
||||
const expectedOrder = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15];
|
||||
assert.deepEqual(actualOrder, expectedOrder);
|
||||
expect(actualOrder).toEqual(expectedOrder);
|
||||
|
||||
assert.equal(MyClass[1], 10);
|
||||
assert.equal(inst[2], 13);
|
||||
assert.equal(inst[3], "foo");
|
||||
expect(MyClass[1]).toBe(10);
|
||||
expect(inst[2]).toBe(13);
|
||||
expect(inst[3]).toBe("foo");
|
||||
inst[4] = "baz";
|
||||
assert.equal(inst.bar, "baz");
|
||||
assert.equal(inst[5], 14);
|
||||
assert.equal(MyClass[6], 11);
|
||||
assert.equal(MyClass[7], 12);
|
||||
assert.ok(typeof inst[8] === "function");
|
||||
assert.equal(inst[9], 15);
|
||||
expect(inst.bar).toBe("baz");
|
||||
expect(inst[5]).toBe(14);
|
||||
expect(MyClass[6]).toBe(11);
|
||||
expect(MyClass[7]).toBe(12);
|
||||
expect(typeof inst[8]).toBe("function");
|
||||
expect(inst[9]).toBe(15);
|
||||
|
||||
@@ -5,9 +5,9 @@ function test(x) {
|
||||
}
|
||||
|
||||
x = 'deadbeef';
|
||||
assert.strictEqual(new F().foo, 1);
|
||||
expect(new F().foo).toBe(1);
|
||||
x = 'wrong';
|
||||
assert.strictEqual(new F().foo, 1);
|
||||
expect(new F().foo).toBe(1);
|
||||
}
|
||||
|
||||
test('foo');
|
||||
|
||||
@@ -5,9 +5,9 @@ function test(x) {
|
||||
}
|
||||
|
||||
x = 'deadbeef';
|
||||
assert.strictEqual(new F().foo, 1);
|
||||
expect(new F().foo).toBe(1);
|
||||
x = 'wrong';
|
||||
assert.strictEqual(new F().foo, 1);
|
||||
expect(new F().foo).toBe(1);
|
||||
}
|
||||
|
||||
test('foo');
|
||||
|
||||
@@ -12,9 +12,9 @@ function test(x) {
|
||||
};
|
||||
|
||||
x = 'deadbeef';
|
||||
assert.strictEqual(new F().foo, 1);
|
||||
expect(new F().foo).toBe(1);
|
||||
x = 'wrong';
|
||||
assert.strictEqual(new F().foo, 1);
|
||||
expect(new F().foo).toBe(1);
|
||||
}
|
||||
|
||||
test('foo');
|
||||
|
||||
@@ -2,6 +2,6 @@ var Foo = class {
|
||||
static num = 0;
|
||||
}
|
||||
|
||||
assert.equal(Foo.num, 0);
|
||||
assert.equal(Foo.num = 1, 1);
|
||||
assert.equal(Foo.name, "Foo");
|
||||
expect(Foo.num).toBe(0);
|
||||
expect(Foo.num = 1).toBe(1);
|
||||
expect(Foo.name).toBe("Foo");
|
||||
|
||||
@@ -2,5 +2,5 @@ class Foo {
|
||||
static num;
|
||||
}
|
||||
|
||||
assert.equal("num" in Foo, true);
|
||||
assert.equal(Foo.num, undefined);
|
||||
expect("num" in Foo).toBe(true);
|
||||
expect(Foo.num).toBeUndefined();
|
||||
|
||||
@@ -3,7 +3,7 @@ class Foo {
|
||||
static str = "foo";
|
||||
}
|
||||
|
||||
assert.equal(Foo.num, 0);
|
||||
assert.equal(Foo.num = 1, 1);
|
||||
assert.equal(Foo.str, "foo");
|
||||
assert.equal(Foo.str = "bar", "bar");
|
||||
expect(Foo.num).toBe(0);
|
||||
expect(Foo.num = 1).toBe(1);
|
||||
expect(Foo.str).toBe("foo");
|
||||
expect(Foo.str = "bar").toBe("bar");
|
||||
|
||||
@@ -5,9 +5,9 @@ function test(x) {
|
||||
}
|
||||
|
||||
x = 'deadbeef';
|
||||
assert.strictEqual(new F().foo, 1);
|
||||
expect(new F().foo).toBe(1);
|
||||
x = 'wrong';
|
||||
assert.strictEqual(new F().foo, 1);
|
||||
expect(new F().foo).toBe(1);
|
||||
}
|
||||
|
||||
test('foo');
|
||||
|
||||
@@ -5,9 +5,9 @@ function test(x) {
|
||||
}
|
||||
|
||||
x = 'deadbeef';
|
||||
assert.strictEqual(new F().foo, 1);
|
||||
expect(new F().foo).toBe(1);
|
||||
x = 'wrong';
|
||||
assert.strictEqual(new F().foo, 1);
|
||||
expect(new F().foo).toBe(1);
|
||||
}
|
||||
|
||||
test('foo');
|
||||
|
||||
@@ -7,9 +7,9 @@ function test(x) {
|
||||
};
|
||||
|
||||
x = 'deadbeef';
|
||||
assert.strictEqual(new F().foo, 1);
|
||||
expect(new F().foo).toBe(1);
|
||||
x = 'wrong';
|
||||
assert.strictEqual(new F().foo, 1);
|
||||
expect(new F().foo).toBe(1);
|
||||
}
|
||||
|
||||
test('foo');
|
||||
|
||||
@@ -2,6 +2,6 @@ var Foo = class {
|
||||
static num = 0;
|
||||
}
|
||||
|
||||
assert.equal(Foo.num, 0);
|
||||
assert.equal(Foo.num = 1, 1);
|
||||
assert.equal(Foo.name, "Foo");
|
||||
expect(Foo.num).toBe(0);
|
||||
expect(Foo.num = 1).toBe(1);
|
||||
expect(Foo.name).toBe("Foo");
|
||||
|
||||
@@ -2,5 +2,5 @@ class Foo {
|
||||
static num;
|
||||
}
|
||||
|
||||
assert.equal("num" in Foo, true);
|
||||
assert.equal(Foo.num, undefined);
|
||||
expect("num" in Foo).toBe(true);
|
||||
expect(Foo.num).toBeUndefined();
|
||||
|
||||
@@ -3,7 +3,7 @@ class Foo {
|
||||
static str = "foo";
|
||||
}
|
||||
|
||||
assert.equal(Foo.num, 0);
|
||||
assert.equal(Foo.num = 1, 1);
|
||||
assert.equal(Foo.str, "foo");
|
||||
assert.equal(Foo.str = "bar", "bar");
|
||||
expect(Foo.num).toBe(0);
|
||||
expect(Foo.num = 1).toBe(1);
|
||||
expect(Foo.str).toBe("foo");
|
||||
expect(Foo.str = "bar").toBe("bar");
|
||||
|
||||
@@ -7,4 +7,4 @@ class Parent {
|
||||
parent() {};
|
||||
}
|
||||
|
||||
assert.equal(Parent.staticProp, "prop");
|
||||
expect(Parent.staticProp).toBe("prop");
|
||||
|
||||
@@ -9,5 +9,5 @@ class Parent {
|
||||
parent(){}
|
||||
}
|
||||
|
||||
assert.equal(typeof Parent.prototype.parent, "function")
|
||||
assert.equal(typeof Parent.prototype.child, "function")
|
||||
expect(typeof Parent.prototype.parent).toBe("function");
|
||||
expect(typeof Parent.prototype.child).toBe("function");
|
||||
|
||||
@@ -11,4 +11,4 @@ export default class Foo {
|
||||
}
|
||||
}
|
||||
|
||||
assert.deepEqual(calls, ["Foo"]);
|
||||
expect(calls).toEqual(["Foo"]);
|
||||
|
||||
@@ -25,4 +25,4 @@ class Example {
|
||||
prop2 = 2;
|
||||
}
|
||||
|
||||
assert.deepEqual(calls, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
|
||||
expect(calls).toEqual([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
|
||||
|
||||
@@ -26,4 +26,4 @@ class Example2 {
|
||||
prop2 = 2;
|
||||
}
|
||||
|
||||
assert.deepEqual(calls, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
|
||||
expect(calls).toEqual([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
function dec(target, name, descriptor) {
|
||||
assert(target);
|
||||
assert.equal(typeof name, "string");
|
||||
assert.equal(typeof descriptor, "object");
|
||||
expect(target).toBeTruthy();
|
||||
expect(typeof name).toBe("string");
|
||||
expect(typeof descriptor).toBe("object");
|
||||
|
||||
target.decoratedProps = (target.decoratedProps || []).concat([name]);
|
||||
|
||||
@@ -58,8 +58,8 @@ class Example {
|
||||
}
|
||||
}
|
||||
|
||||
assert(Example.prototype.hasOwnProperty('decoratedProps'));
|
||||
assert.deepEqual(Example.prototype.decoratedProps, [
|
||||
expect(Example.prototype).toHaveProperty('decoratedProps');
|
||||
expect(Example.prototype.decoratedProps).toEqual([
|
||||
"enumconfwrite",
|
||||
"enumconf",
|
||||
"enumwrite",
|
||||
@@ -74,42 +74,42 @@ const inst = new Example();
|
||||
|
||||
const descs = Object.getOwnPropertyDescriptors(Example.prototype);
|
||||
|
||||
assert(descs.enumconfwrite.enumerable);
|
||||
assert(descs.enumconfwrite.writable);
|
||||
assert(descs.enumconfwrite.configurable);
|
||||
assert.equal(inst.enumconfwrite(), "__1__");
|
||||
expect(descs.enumconfwrite.enumerable).toBeTruthy();
|
||||
expect(descs.enumconfwrite.writable).toBeTruthy();
|
||||
expect(descs.enumconfwrite.configurable).toBeTruthy();
|
||||
expect(inst.enumconfwrite()).toBe("__1__");
|
||||
|
||||
assert(descs.enumconf.enumerable);
|
||||
assert.equal(descs.enumconf.writable, false);
|
||||
assert(descs.enumconf.configurable);
|
||||
assert.equal(inst.enumconf(), "__2__");
|
||||
expect(descs.enumconf.enumerable).toBeTruthy();
|
||||
expect(descs.enumconf.writable).toBe(false);
|
||||
expect(descs.enumconf.configurable).toBeTruthy();
|
||||
expect(inst.enumconf()).toBe("__2__");
|
||||
|
||||
assert(descs.enumwrite.enumerable);
|
||||
assert(descs.enumwrite.writable);
|
||||
assert.equal(descs.enumwrite.configurable, false);
|
||||
assert.equal(inst.enumwrite(), "__3__");
|
||||
expect(descs.enumwrite.enumerable).toBeTruthy();
|
||||
expect(descs.enumwrite.writable).toBeTruthy();
|
||||
expect(descs.enumwrite.configurable).toBe(false);
|
||||
expect(inst.enumwrite()).toBe("__3__");
|
||||
|
||||
assert(descs.enum.enumerable);
|
||||
assert.equal(descs.enum.writable, false);
|
||||
assert.equal(descs.enum.configurable, false);
|
||||
assert.equal(inst.enum(), "__4__");
|
||||
expect(descs.enum.enumerable).toBeTruthy();
|
||||
expect(descs.enum.writable).toBe(false);
|
||||
expect(descs.enum.configurable).toBe(false);
|
||||
expect(inst.enum()).toBe("__4__");
|
||||
|
||||
assert.equal(descs.confwrite.enumerable, false);
|
||||
assert(descs.confwrite.writable);
|
||||
assert(descs.confwrite.configurable);
|
||||
assert.equal(inst.confwrite(), "__5__");
|
||||
expect(descs.confwrite.enumerable).toBe(false);
|
||||
expect(descs.confwrite.writable).toBeTruthy();
|
||||
expect(descs.confwrite.configurable).toBeTruthy();
|
||||
expect(inst.confwrite()).toBe("__5__");
|
||||
|
||||
assert.equal(descs.conf.enumerable, false);
|
||||
assert.equal(descs.conf.writable, false);
|
||||
assert(descs.conf.configurable);
|
||||
assert.equal(inst.conf(), "__6__");
|
||||
expect(descs.conf.enumerable).toBe(false);
|
||||
expect(descs.conf.writable).toBe(false);
|
||||
expect(descs.conf.configurable).toBeTruthy();
|
||||
expect(inst.conf()).toBe("__6__");
|
||||
|
||||
assert.equal(descs.write.enumerable, false);
|
||||
assert(descs.write.writable);
|
||||
assert.equal(descs.write.configurable, false);
|
||||
assert.equal(inst.write(), "__7__");
|
||||
expect(descs.write.enumerable).toBe(false);
|
||||
expect(descs.write.writable).toBeTruthy();
|
||||
expect(descs.write.configurable).toBe(false);
|
||||
expect(inst.write()).toBe("__7__");
|
||||
|
||||
assert.equal(descs._.enumerable, false);
|
||||
assert.equal(descs._.writable, false);
|
||||
assert.equal(descs._.configurable, false);
|
||||
assert.equal(inst._(), "__8__");
|
||||
expect(descs._.enumerable).toBe(false);
|
||||
expect(descs._.writable).toBe(false);
|
||||
expect(descs._.configurable).toBe(false);
|
||||
expect(inst._()).toBe("__8__");
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
function dec(target, name, descriptor) {
|
||||
assert(target);
|
||||
assert.equal(name, 4);
|
||||
assert.equal(typeof descriptor, "object");
|
||||
expect(target).toBeTruthy();
|
||||
expect(name).toBe(4);
|
||||
expect(typeof descriptor).toBe("object");
|
||||
}
|
||||
|
||||
class Example {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
function dec(target, name, descriptor) {
|
||||
assert(target);
|
||||
assert.equal(typeof name, "string");
|
||||
assert.equal(typeof descriptor, "object");
|
||||
expect(target).toBeTruthy();
|
||||
expect(typeof name).toBe("string");
|
||||
expect(typeof descriptor).toBe("object");
|
||||
|
||||
target.decoratedProps = (target.decoratedProps || []).concat([name]);
|
||||
|
||||
@@ -59,8 +59,8 @@ class Example {
|
||||
}
|
||||
|
||||
|
||||
assert(Example.prototype.hasOwnProperty('decoratedProps'));
|
||||
assert.deepEqual(Example.prototype.decoratedProps, [
|
||||
expect(Example.prototype).toHaveProperty('decoratedProps');
|
||||
expect(Example.prototype.decoratedProps).toEqual([
|
||||
"enumconfwrite",
|
||||
"enumconf",
|
||||
"enumwrite",
|
||||
@@ -76,42 +76,42 @@ const inst = new Example();
|
||||
|
||||
const descs = Object.getOwnPropertyDescriptors(Example.prototype);
|
||||
|
||||
assert(descs.enumconfwrite.enumerable);
|
||||
assert(descs.enumconfwrite.writable);
|
||||
assert(descs.enumconfwrite.configurable);
|
||||
assert.equal(inst.enumconfwrite(), "__1__");
|
||||
expect(descs.enumconfwrite.enumerable).toBeTruthy();
|
||||
expect(descs.enumconfwrite.writable).toBeTruthy();
|
||||
expect(descs.enumconfwrite.configurable).toBeTruthy();
|
||||
expect(inst.enumconfwrite()).toBe("__1__");
|
||||
|
||||
assert(descs.enumconf.enumerable);
|
||||
assert.equal(descs.enumconf.writable, false);
|
||||
assert(descs.enumconf.configurable);
|
||||
assert.equal(inst.enumconf(), "__2__");
|
||||
expect(descs.enumconf.enumerable).toBeTruthy();
|
||||
expect(descs.enumconf.writable).toBe(false);
|
||||
expect(descs.enumconf.configurable).toBeTruthy();
|
||||
expect(inst.enumconf()).toBe("__2__");
|
||||
|
||||
assert(descs.enumwrite.enumerable);
|
||||
assert(descs.enumwrite.writable);
|
||||
assert.equal(descs.enumwrite.configurable, false);
|
||||
assert.equal(inst.enumwrite(), "__3__");
|
||||
expect(descs.enumwrite.enumerable).toBeTruthy();
|
||||
expect(descs.enumwrite.writable).toBeTruthy();
|
||||
expect(descs.enumwrite.configurable).toBe(false);
|
||||
expect(inst.enumwrite()).toBe("__3__");
|
||||
|
||||
assert(descs.enum.enumerable);
|
||||
assert.equal(descs.enum.writable, false);
|
||||
assert.equal(descs.enum.configurable, false);
|
||||
assert.equal(inst.enum(), "__4__");
|
||||
expect(descs.enum.enumerable).toBeTruthy();
|
||||
expect(descs.enum.writable).toBe(false);
|
||||
expect(descs.enum.configurable).toBe(false);
|
||||
expect(inst.enum()).toBe("__4__");
|
||||
|
||||
assert.equal(descs.confwrite.enumerable, false);
|
||||
assert(descs.confwrite.writable);
|
||||
assert(descs.confwrite.configurable);
|
||||
assert.equal(inst.confwrite(), "__5__");
|
||||
expect(descs.confwrite.enumerable).toBe(false);
|
||||
expect(descs.confwrite.writable).toBeTruthy();
|
||||
expect(descs.confwrite.configurable).toBeTruthy();
|
||||
expect(inst.confwrite()).toBe("__5__");
|
||||
|
||||
assert.equal(descs.conf.enumerable, false);
|
||||
assert.equal(descs.conf.writable, false);
|
||||
assert(descs.conf.configurable);
|
||||
assert.equal(inst.conf(), "__6__");
|
||||
expect(descs.conf.enumerable).toBe(false);
|
||||
expect(descs.conf.writable).toBe(false);
|
||||
expect(descs.conf.configurable).toBeTruthy();
|
||||
expect(inst.conf()).toBe("__6__");
|
||||
|
||||
assert.equal(descs.write.enumerable, false);
|
||||
assert(descs.write.writable);
|
||||
assert.equal(descs.write.configurable, false);
|
||||
assert.equal(inst.write(), "__7__");
|
||||
expect(descs.write.enumerable).toBe(false);
|
||||
expect(descs.write.writable).toBeTruthy();
|
||||
expect(descs.write.configurable).toBe(false);
|
||||
expect(inst.write()).toBe("__7__");
|
||||
|
||||
assert.equal(descs._.enumerable, false);
|
||||
assert.equal(descs._.writable, false);
|
||||
assert.equal(descs._.configurable, false);
|
||||
assert.equal(inst._(), "__8__");
|
||||
expect(descs._.enumerable).toBe(false);
|
||||
expect(descs._.writable).toBe(false);
|
||||
expect(descs._.configurable).toBe(false);
|
||||
expect(inst._()).toBe("__8__");
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
function dec(target, name, descriptor) {
|
||||
assert(target);
|
||||
assert.equal(name, "str");
|
||||
assert.equal(typeof descriptor, "object");
|
||||
expect(target).toBeTruthy();
|
||||
expect(name).toBe("str");
|
||||
expect(typeof descriptor).toBe("object");
|
||||
}
|
||||
|
||||
class Example {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
function dec(target, name, descriptor){
|
||||
assert(target);
|
||||
assert.equal(typeof name, "string");
|
||||
assert.equal(typeof descriptor, "object");
|
||||
expect(target).toBeTruthy();
|
||||
expect(typeof name).toBe("string");
|
||||
expect(typeof descriptor).toBe("object");
|
||||
|
||||
target.decoratedProps = (target.decoratedProps || []).concat([name]);
|
||||
|
||||
@@ -23,5 +23,5 @@ class Example extends Base {
|
||||
|
||||
let inst = new Example();
|
||||
|
||||
assert.equal(inst.prop, "__3__");
|
||||
assert.equal(inst.prop2, "__4__");
|
||||
expect(inst.prop).toBe("__3__");
|
||||
expect(inst.prop2).toBe("__4__");
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
function dec(target, name, descriptor) {
|
||||
assert(target);
|
||||
assert.equal(typeof name, "string");
|
||||
assert.equal(typeof descriptor, "object");
|
||||
expect(target).toBeTruthy();
|
||||
expect(typeof name).toBe("string");
|
||||
expect(typeof descriptor).toBe("object");
|
||||
|
||||
target.decoratedProps = (target.decoratedProps || []).concat([name]);
|
||||
|
||||
@@ -44,8 +44,8 @@ class Example {
|
||||
|
||||
const inst = new Example();
|
||||
|
||||
assert(Example.prototype.hasOwnProperty("decoratedProps"));
|
||||
assert.deepEqual(inst.decoratedProps, [
|
||||
expect(Example.prototype).toHaveProperty("decoratedProps");
|
||||
expect(inst.decoratedProps).toEqual([
|
||||
"enumconfwrite",
|
||||
"enumconf",
|
||||
"enumwrite",
|
||||
@@ -58,42 +58,42 @@ assert.deepEqual(inst.decoratedProps, [
|
||||
|
||||
const descs = Object.getOwnPropertyDescriptors(inst);
|
||||
|
||||
assert(descs.enumconfwrite.enumerable);
|
||||
assert(descs.enumconfwrite.writable);
|
||||
assert(descs.enumconfwrite.configurable);
|
||||
assert.equal(inst.enumconfwrite, "__1__");
|
||||
expect(descs.enumconfwrite.enumerable).toBeTruthy();
|
||||
expect(descs.enumconfwrite.writable).toBeTruthy();
|
||||
expect(descs.enumconfwrite.configurable).toBeTruthy();
|
||||
expect(inst.enumconfwrite).toBe("__1__");
|
||||
|
||||
assert(descs.enumconf.enumerable);
|
||||
assert.equal(descs.enumconf.writable, false);
|
||||
assert(descs.enumconf.configurable);
|
||||
assert.equal(inst.enumconf, "__2__");
|
||||
expect(descs.enumconf.enumerable).toBeTruthy();
|
||||
expect(descs.enumconf.writable).toBe(false);
|
||||
expect(descs.enumconf.configurable).toBeTruthy();
|
||||
expect(inst.enumconf).toBe("__2__");
|
||||
|
||||
assert(descs.enumwrite.enumerable);
|
||||
assert(descs.enumwrite.writable);
|
||||
assert.equal(descs.enumwrite.configurable, false);
|
||||
assert.equal(inst.enumwrite, "__3__");
|
||||
expect(descs.enumwrite.enumerable).toBeTruthy();
|
||||
expect(descs.enumwrite.writable).toBeTruthy();
|
||||
expect(descs.enumwrite.configurable).toBe(false);
|
||||
expect(inst.enumwrite).toBe("__3__");
|
||||
|
||||
assert(descs.enum.enumerable);
|
||||
assert.equal(descs.enum.writable, false);
|
||||
assert.equal(descs.enum.configurable, false);
|
||||
assert.equal(inst.enum, "__4__");
|
||||
expect(descs.enum.enumerable).toBeTruthy();
|
||||
expect(descs.enum.writable).toBe(false);
|
||||
expect(descs.enum.configurable).toBe(false);
|
||||
expect(inst.enum).toBe("__4__");
|
||||
|
||||
assert.equal(descs.confwrite.enumerable, false);
|
||||
assert(descs.confwrite.writable);
|
||||
assert(descs.confwrite.configurable);
|
||||
assert.equal(inst.confwrite, "__5__");
|
||||
expect(descs.confwrite.enumerable).toBe(false);
|
||||
expect(descs.confwrite.writable).toBeTruthy();
|
||||
expect(descs.confwrite.configurable).toBeTruthy();
|
||||
expect(inst.confwrite).toBe("__5__");
|
||||
|
||||
assert.equal(descs.conf.enumerable, false);
|
||||
assert.equal(descs.conf.writable, false);
|
||||
assert(descs.conf.configurable);
|
||||
assert.equal(inst.conf, "__6__");
|
||||
expect(descs.conf.enumerable).toBe(false);
|
||||
expect(descs.conf.writable).toBe(false);
|
||||
expect(descs.conf.configurable).toBeTruthy();
|
||||
expect(inst.conf).toBe("__6__");
|
||||
|
||||
assert.equal(descs.write.enumerable, false);
|
||||
assert(descs.write.writable);
|
||||
assert.equal(descs.write.configurable, false);
|
||||
assert.equal(inst.write, "__7__");
|
||||
expect(descs.write.enumerable).toBe(false);
|
||||
expect(descs.write.writable).toBeTruthy();
|
||||
expect(descs.write.configurable).toBe(false);
|
||||
expect(inst.write).toBe("__7__");
|
||||
|
||||
assert.equal(descs._.enumerable, false);
|
||||
assert.equal(descs._.writable, false);
|
||||
assert.equal(descs._.configurable, false);
|
||||
assert.equal(inst._, "__8__");
|
||||
expect(descs._.enumerable).toBe(false);
|
||||
expect(descs._.writable).toBe(false);
|
||||
expect(descs._.configurable).toBe(false);
|
||||
expect(inst._).toBe("__8__");
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
function dec(target, name, descriptor){
|
||||
assert(target);
|
||||
assert.equal(name, "prop");
|
||||
assert.equal(typeof descriptor, "object");
|
||||
expect(target).toBeTruthy();
|
||||
expect(name).toBe("prop");
|
||||
expect(typeof descriptor).toBe("object");
|
||||
|
||||
let {initializer} = descriptor;
|
||||
delete descriptor.initializer;
|
||||
@@ -24,4 +24,4 @@ class Example {
|
||||
|
||||
let inst = new Example();
|
||||
|
||||
assert.equal(inst.prop, "__3__");
|
||||
expect(inst.prop).toBe("__3__");
|
||||
|
||||
@@ -7,5 +7,5 @@ class Example {
|
||||
}
|
||||
|
||||
let inst = new Example();
|
||||
assert(inst.hasOwnProperty("prop"));
|
||||
assert.equal(inst.prop, undefined);
|
||||
expect(inst).toHaveProperty("prop");
|
||||
expect(inst.prop).toBeUndefined();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
function dec(target, name, descriptor) {
|
||||
assert(target);
|
||||
assert.equal(typeof name, "string");
|
||||
assert.equal(typeof descriptor, "object");
|
||||
expect(target).toBeTruthy();
|
||||
expect(typeof name).toBe("string");
|
||||
expect(typeof descriptor).toBe("object");
|
||||
|
||||
target.decoratedProps = (target.decoratedProps || []).concat([name]);
|
||||
|
||||
@@ -44,8 +44,8 @@ class Example {
|
||||
|
||||
const inst = new Example();
|
||||
|
||||
assert(Example.prototype.hasOwnProperty("decoratedProps"));
|
||||
assert.deepEqual(inst.decoratedProps, [
|
||||
expect(Example.prototype).toHaveProperty("decoratedProps");
|
||||
expect(inst.decoratedProps).toEqual([
|
||||
"enumconfwrite",
|
||||
"enumconf",
|
||||
"enumwrite",
|
||||
@@ -58,42 +58,42 @@ assert.deepEqual(inst.decoratedProps, [
|
||||
|
||||
const descs = Object.getOwnPropertyDescriptors(inst);
|
||||
|
||||
assert(descs.enumconfwrite.enumerable);
|
||||
assert(descs.enumconfwrite.writable);
|
||||
assert(descs.enumconfwrite.configurable);
|
||||
assert.equal(inst.enumconfwrite, "__1__");
|
||||
expect(descs.enumconfwrite.enumerable).toBeTruthy();
|
||||
expect(descs.enumconfwrite.writable).toBeTruthy();
|
||||
expect(descs.enumconfwrite.configurable).toBeTruthy();
|
||||
expect(inst.enumconfwrite).toBe("__1__");
|
||||
|
||||
assert(descs.enumconf.enumerable);
|
||||
assert.equal(descs.enumconf.writable, false);
|
||||
assert(descs.enumconf.configurable);
|
||||
assert.equal(inst.enumconf, "__2__");
|
||||
expect(descs.enumconf.enumerable).toBeTruthy();
|
||||
expect(descs.enumconf.writable).toBe(false);
|
||||
expect(descs.enumconf.configurable).toBeTruthy();
|
||||
expect(inst.enumconf).toBe("__2__");
|
||||
|
||||
assert(descs.enumwrite.enumerable);
|
||||
assert(descs.enumwrite.writable);
|
||||
assert.equal(descs.enumwrite.configurable, false);
|
||||
assert.equal(inst.enumwrite, "__3__");
|
||||
expect(descs.enumwrite.enumerable).toBeTruthy();
|
||||
expect(descs.enumwrite.writable).toBeTruthy();
|
||||
expect(descs.enumwrite.configurable).toBe(false);
|
||||
expect(inst.enumwrite).toBe("__3__");
|
||||
|
||||
assert(descs.enum.enumerable);
|
||||
assert.equal(descs.enum.writable, false);
|
||||
assert.equal(descs.enum.configurable, false);
|
||||
assert.equal(inst.enum, "__4__");
|
||||
expect(descs.enum.enumerable).toBeTruthy();
|
||||
expect(descs.enum.writable).toBe(false);
|
||||
expect(descs.enum.configurable).toBe(false);
|
||||
expect(inst.enum).toBe("__4__");
|
||||
|
||||
assert.equal(descs.confwrite.enumerable, false);
|
||||
assert(descs.confwrite.writable);
|
||||
assert(descs.confwrite.configurable);
|
||||
assert.equal(inst.confwrite, "__5__");
|
||||
expect(descs.confwrite.enumerable).toBe(false);
|
||||
expect(descs.confwrite.writable).toBeTruthy();
|
||||
expect(descs.confwrite.configurable).toBeTruthy();
|
||||
expect(inst.confwrite).toBe("__5__");
|
||||
|
||||
assert.equal(descs.conf.enumerable, false);
|
||||
assert.equal(descs.conf.writable, false);
|
||||
assert(descs.conf.configurable);
|
||||
assert.equal(inst.conf, "__6__");
|
||||
expect(descs.conf.enumerable).toBe(false);
|
||||
expect(descs.conf.writable).toBe(false);
|
||||
expect(descs.conf.configurable).toBeTruthy();
|
||||
expect(inst.conf).toBe("__6__");
|
||||
|
||||
assert.equal(descs.write.enumerable, false);
|
||||
assert(descs.write.writable);
|
||||
assert.equal(descs.write.configurable, false);
|
||||
assert.equal(inst.write, "__7__");
|
||||
expect(descs.write.enumerable).toBe(false);
|
||||
expect(descs.write.writable).toBeTruthy();
|
||||
expect(descs.write.configurable).toBe(false);
|
||||
expect(inst.write).toBe("__7__");
|
||||
|
||||
assert.equal(descs._.enumerable, false);
|
||||
assert.equal(descs._.writable, false);
|
||||
assert.equal(descs._.configurable, false);
|
||||
assert.equal(inst._, "__8__");
|
||||
expect(descs._.enumerable).toBe(false);
|
||||
expect(descs._.writable).toBe(false);
|
||||
expect(descs._.configurable).toBe(false);
|
||||
expect(inst._).toBe("__8__");
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
function dec(target, name, descriptor) {
|
||||
assert(target);
|
||||
assert.equal(typeof name, "string");
|
||||
assert.equal(typeof descriptor, "object");
|
||||
expect(target).toBeTruthy();
|
||||
expect(typeof name).toBe("string");
|
||||
expect(typeof descriptor).toBe("object");
|
||||
|
||||
target.decoratedProps = (target.decoratedProps || []).concat([name]);
|
||||
|
||||
@@ -58,8 +58,8 @@ class Example {
|
||||
}
|
||||
}
|
||||
|
||||
assert(Example.hasOwnProperty("decoratedProps"));
|
||||
assert.deepEqual(Example.decoratedProps, [
|
||||
expect(Example).toHaveProperty("decoratedProps");
|
||||
expect(Example.decoratedProps).toEqual([
|
||||
"enumconfwrite",
|
||||
"enumconf",
|
||||
"enumwrite",
|
||||
@@ -72,42 +72,42 @@ assert.deepEqual(Example.decoratedProps, [
|
||||
|
||||
const descs = Object.getOwnPropertyDescriptors(Example);
|
||||
|
||||
assert(descs.enumconfwrite.enumerable);
|
||||
assert(descs.enumconfwrite.writable);
|
||||
assert(descs.enumconfwrite.configurable);
|
||||
assert.equal(Example.enumconfwrite(), "__1__");
|
||||
expect(descs.enumconfwrite.enumerable).toBeTruthy();
|
||||
expect(descs.enumconfwrite.writable).toBeTruthy();
|
||||
expect(descs.enumconfwrite.configurable).toBeTruthy();
|
||||
expect(Example.enumconfwrite()).toBe("__1__");
|
||||
|
||||
assert(descs.enumconf.enumerable);
|
||||
assert.equal(descs.enumconf.writable, false);
|
||||
assert(descs.enumconf.configurable);
|
||||
assert.equal(Example.enumconf(), "__2__");
|
||||
expect(descs.enumconf.enumerable).toBeTruthy();
|
||||
expect(descs.enumconf.writable).toBe(false);
|
||||
expect(descs.enumconf.configurable).toBeTruthy();
|
||||
expect(Example.enumconf()).toBe("__2__");
|
||||
|
||||
assert(descs.enumwrite.enumerable);
|
||||
assert(descs.enumwrite.writable);
|
||||
assert.equal(descs.enumwrite.configurable, false);
|
||||
assert.equal(Example.enumwrite(), "__3__");
|
||||
expect(descs.enumwrite.enumerable).toBeTruthy();
|
||||
expect(descs.enumwrite.writable).toBeTruthy();
|
||||
expect(descs.enumwrite.configurable).toBe(false);
|
||||
expect(Example.enumwrite()).toBe("__3__");
|
||||
|
||||
assert(descs.enum.enumerable);
|
||||
assert.equal(descs.enum.writable, false);
|
||||
assert.equal(descs.enum.configurable, false);
|
||||
assert.equal(Example.enum(), "__4__");
|
||||
expect(descs.enum.enumerable).toBeTruthy();
|
||||
expect(descs.enum.writable).toBe(false);
|
||||
expect(descs.enum.configurable).toBe(false);
|
||||
expect(Example.enum()).toBe("__4__");
|
||||
|
||||
assert.equal(descs.confwrite.enumerable, false);
|
||||
assert(descs.confwrite.writable);
|
||||
assert(descs.confwrite.configurable);
|
||||
assert.equal(Example.confwrite(), "__5__");
|
||||
expect(descs.confwrite.enumerable).toBe(false);
|
||||
expect(descs.confwrite.writable).toBeTruthy();
|
||||
expect(descs.confwrite.configurable).toBeTruthy();
|
||||
expect(Example.confwrite()).toBe("__5__");
|
||||
|
||||
assert.equal(descs.conf.enumerable, false);
|
||||
assert.equal(descs.conf.writable, false);
|
||||
assert(descs.conf.configurable);
|
||||
assert.equal(Example.conf(), "__6__");
|
||||
expect(descs.conf.enumerable).toBe(false);
|
||||
expect(descs.conf.writable).toBe(false);
|
||||
expect(descs.conf.configurable).toBeTruthy();
|
||||
expect(Example.conf()).toBe("__6__");
|
||||
|
||||
assert.equal(descs.write.enumerable, false);
|
||||
assert(descs.write.writable);
|
||||
assert.equal(descs.write.configurable, false);
|
||||
assert.equal(Example.write(), "__7__");
|
||||
expect(descs.write.enumerable).toBe(false);
|
||||
expect(descs.write.writable).toBeTruthy();
|
||||
expect(descs.write.configurable).toBe(false);
|
||||
expect(Example.write()).toBe("__7__");
|
||||
|
||||
assert.equal(descs._.enumerable, false);
|
||||
assert.equal(descs._.writable, false);
|
||||
assert.equal(descs._.configurable, false);
|
||||
assert.equal(Example._(), "__8__");
|
||||
expect(descs._.enumerable).toBe(false);
|
||||
expect(descs._.writable).toBe(false);
|
||||
expect(descs._.configurable).toBe(false);
|
||||
expect(Example._()).toBe("__8__");
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
function dec(target, name, descriptor){
|
||||
assert(target);
|
||||
assert.equal(name, 4);
|
||||
assert.equal(typeof descriptor, "object");
|
||||
expect(target).toBeTruthy();
|
||||
expect(name).toBe(4);
|
||||
expect(typeof descriptor).toBe("object");
|
||||
}
|
||||
|
||||
class Example {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
function dec(target, name, descriptor) {
|
||||
assert(target);
|
||||
assert.equal(typeof name, "string");
|
||||
assert.equal(typeof descriptor, "object");
|
||||
expect(target).toBeTruthy();
|
||||
expect(typeof name).toBe("string");
|
||||
expect(typeof descriptor).toBe("object");
|
||||
|
||||
target.decoratedProps = (target.decoratedProps || []).concat([name]);
|
||||
|
||||
@@ -59,8 +59,8 @@ class Example {
|
||||
}
|
||||
|
||||
|
||||
assert(Example.hasOwnProperty("decoratedProps"));
|
||||
assert.deepEqual(Example.decoratedProps, [
|
||||
expect(Example).toHaveProperty("decoratedProps");
|
||||
expect(Example.decoratedProps).toEqual([
|
||||
"enumconfwrite",
|
||||
"enumconf",
|
||||
"enumwrite",
|
||||
@@ -73,42 +73,42 @@ assert.deepEqual(Example.decoratedProps, [
|
||||
|
||||
const descs = Object.getOwnPropertyDescriptors(Example);
|
||||
|
||||
assert(descs.enumconfwrite.enumerable);
|
||||
assert(descs.enumconfwrite.writable);
|
||||
assert(descs.enumconfwrite.configurable);
|
||||
assert.equal(Example.enumconfwrite(), "__1__");
|
||||
expect(descs.enumconfwrite.enumerable).toBeTruthy();
|
||||
expect(descs.enumconfwrite.writable).toBeTruthy();
|
||||
expect(descs.enumconfwrite.configurable).toBeTruthy();
|
||||
expect(Example.enumconfwrite()).toBe("__1__");
|
||||
|
||||
assert(descs.enumconf.enumerable);
|
||||
assert.equal(descs.enumconf.writable, false);
|
||||
assert(descs.enumconf.configurable);
|
||||
assert.equal(Example.enumconf(), "__2__");
|
||||
expect(descs.enumconf.enumerable).toBeTruthy();
|
||||
expect(descs.enumconf.writable).toBe(false);
|
||||
expect(descs.enumconf.configurable).toBeTruthy();
|
||||
expect(Example.enumconf()).toBe("__2__");
|
||||
|
||||
assert(descs.enumwrite.enumerable);
|
||||
assert(descs.enumwrite.writable);
|
||||
assert.equal(descs.enumwrite.configurable, false);
|
||||
assert.equal(Example.enumwrite(), "__3__");
|
||||
expect(descs.enumwrite.enumerable).toBeTruthy();
|
||||
expect(descs.enumwrite.writable).toBeTruthy();
|
||||
expect(descs.enumwrite.configurable).toBe(false);
|
||||
expect(Example.enumwrite()).toBe("__3__");
|
||||
|
||||
assert(descs.enum.enumerable);
|
||||
assert.equal(descs.enum.writable, false);
|
||||
assert.equal(descs.enum.configurable, false);
|
||||
assert.equal(Example.enum(), "__4__");
|
||||
expect(descs.enum.enumerable).toBeTruthy();
|
||||
expect(descs.enum.writable).toBe(false);
|
||||
expect(descs.enum.configurable).toBe(false);
|
||||
expect(Example.enum()).toBe("__4__");
|
||||
|
||||
assert.equal(descs.confwrite.enumerable, false);
|
||||
assert(descs.confwrite.writable);
|
||||
assert(descs.confwrite.configurable);
|
||||
assert.equal(Example.confwrite(), "__5__");
|
||||
expect(descs.confwrite.enumerable).toBe(false);
|
||||
expect(descs.confwrite.writable).toBeTruthy();
|
||||
expect(descs.confwrite.configurable);
|
||||
expect(Example.confwrite()).toBe("__5__");
|
||||
|
||||
assert.equal(descs.conf.enumerable, false);
|
||||
assert.equal(descs.conf.writable, false);
|
||||
assert(descs.conf.configurable);
|
||||
assert.equal(Example.conf(), "__6__");
|
||||
expect(descs.conf.enumerable).toBe(false);
|
||||
expect(descs.conf.writable).toBe(false);
|
||||
expect(descs.conf.configurable).toBeTruthy();
|
||||
expect(Example.conf()).toBe("__6__");
|
||||
|
||||
assert.equal(descs.write.enumerable, false);
|
||||
assert(descs.write.writable);
|
||||
assert.equal(descs.write.configurable, false);
|
||||
assert.equal(Example.write(), "__7__");
|
||||
expect(descs.write.enumerable).toBe(false);
|
||||
expect(descs.write.writable).toBeTruthy();
|
||||
expect(descs.write.configurable).toBe(false);
|
||||
expect(Example.write()).toBe("__7__");
|
||||
|
||||
assert.equal(descs._.enumerable, false);
|
||||
assert.equal(descs._.writable, false);
|
||||
assert.equal(descs._.configurable, false);
|
||||
assert.equal(Example._(), "__8__");
|
||||
expect(descs._.enumerable).toBe(false);
|
||||
expect(descs._.writable).toBe(false);
|
||||
expect(descs._.configurable).toBe(false);
|
||||
expect(Example._()).toBe("__8__");
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
function dec(target, name, descriptor) {
|
||||
assert(target);
|
||||
assert.equal(name, "str");
|
||||
assert.equal(typeof descriptor, "object");
|
||||
expect(target).toBeTruthy();
|
||||
expect(name).toBe("str");
|
||||
expect(typeof descriptor).toBe("object");
|
||||
}
|
||||
|
||||
class Example {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
function dec(target, name, descriptor) {
|
||||
assert(target);
|
||||
assert.equal(typeof name, "string");
|
||||
assert.equal(typeof descriptor, "object");
|
||||
expect(target).toBeTruthy();
|
||||
expect(typeof name).toBe("string");
|
||||
expect(typeof descriptor).toBe("object");
|
||||
|
||||
target.decoratedProps = (target.decoratedProps || []).concat([name]);
|
||||
|
||||
@@ -44,8 +44,8 @@ class Example {
|
||||
|
||||
const inst = new Example();
|
||||
|
||||
assert(Example.hasOwnProperty("decoratedProps"));
|
||||
assert.deepEqual(Example.decoratedProps, [
|
||||
expect(Example).toHaveProperty("decoratedProps");
|
||||
expect(Example.decoratedProps).toEqual([
|
||||
"enumconfwrite",
|
||||
"enumconf",
|
||||
"enumwrite",
|
||||
@@ -58,42 +58,42 @@ assert.deepEqual(Example.decoratedProps, [
|
||||
|
||||
const descs = Object.getOwnPropertyDescriptors(Example);
|
||||
|
||||
assert(descs.enumconfwrite.enumerable);
|
||||
assert(descs.enumconfwrite.writable);
|
||||
assert(descs.enumconfwrite.configurable);
|
||||
assert.equal(Example.enumconfwrite, "__1__");
|
||||
expect(descs.enumconfwrite.enumerable).toBeTruthy();
|
||||
expect(descs.enumconfwrite.writable).toBeTruthy();
|
||||
expect(descs.enumconfwrite.configurable).toBeTruthy();
|
||||
expect(Example.enumconfwrite).toBe("__1__");
|
||||
|
||||
assert(descs.enumconf.enumerable);
|
||||
assert.equal(descs.enumconf.writable, false);
|
||||
assert(descs.enumconf.configurable);
|
||||
assert.equal(Example.enumconf, "__2__");
|
||||
expect(descs.enumconf.enumerable).toBeTruthy();
|
||||
expect(descs.enumconf.writable).toBe(false);
|
||||
expect(descs.enumconf.configurable).toBeTruthy();
|
||||
expect(Example.enumconf).toBe("__2__");
|
||||
|
||||
assert(descs.enumwrite.enumerable);
|
||||
assert(descs.enumwrite.writable);
|
||||
assert.equal(descs.enumwrite.configurable, false);
|
||||
assert.equal(Example.enumwrite, "__3__");
|
||||
expect(descs.enumwrite.enumerable).toBeTruthy();
|
||||
expect(descs.enumwrite.writable).toBeTruthy();
|
||||
expect(descs.enumwrite.configurable).toBe(false);
|
||||
expect(Example.enumwrite).toBe("__3__");
|
||||
|
||||
assert(descs.enum.enumerable);
|
||||
assert.equal(descs.enum.writable, false);
|
||||
assert.equal(descs.enum.configurable, false);
|
||||
assert.equal(Example.enum, "__4__");
|
||||
expect(descs.enum.enumerable).toBeTruthy();
|
||||
expect(descs.enum.writable).toBe(false);
|
||||
expect(descs.enum.configurable).toBe(false);
|
||||
expect(Example.enum).toBe("__4__");
|
||||
|
||||
assert.equal(descs.confwrite.enumerable, false);
|
||||
assert(descs.confwrite.writable);
|
||||
assert(descs.confwrite.configurable);
|
||||
assert.equal(Example.confwrite, "__5__");
|
||||
expect(descs.confwrite.enumerable).toBe(false);
|
||||
expect(descs.confwrite.writable).toBeTruthy();
|
||||
expect(descs.confwrite.configurable).toBeTruthy();
|
||||
expect(Example.confwrite).toBe("__5__");
|
||||
|
||||
assert.equal(descs.conf.enumerable, false);
|
||||
assert.equal(descs.conf.writable, false);
|
||||
assert(descs.conf.configurable);
|
||||
assert.equal(Example.conf, "__6__");
|
||||
expect(descs.conf.enumerable).toBe(false);
|
||||
expect(descs.conf.writable).toBe(false);
|
||||
expect(descs.conf.configurable).toBeTruthy();
|
||||
expect(Example.conf).toBe("__6__");
|
||||
|
||||
assert.equal(descs.write.enumerable, false);
|
||||
assert(descs.write.writable);
|
||||
assert.equal(descs.write.configurable, false);
|
||||
assert.equal(Example.write, "__7__");
|
||||
expect(descs.write.enumerable).toBe(false);
|
||||
expect(descs.write.writable).toBeTruthy();
|
||||
expect(descs.write.configurable).toBe(false);
|
||||
expect(Example.write).toBe("__7__");
|
||||
|
||||
assert.equal(descs._.enumerable, false);
|
||||
assert.equal(descs._.writable, false);
|
||||
assert.equal(descs._.configurable, false);
|
||||
assert.equal(Example._, "__8__");
|
||||
expect(descs._.enumerable).toBe(false);
|
||||
expect(descs._.writable).toBe(false);
|
||||
expect(descs._.configurable).toBe(false);
|
||||
expect(Example._).toBe("__8__");
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
function dec(target, name, descriptor){
|
||||
assert(target);
|
||||
assert.equal(name, "prop");
|
||||
assert.equal(typeof descriptor, "object");
|
||||
expect(target).toBeTruthy();
|
||||
expect(name).toBe("prop");
|
||||
expect(typeof descriptor).toBe("object");
|
||||
|
||||
let {initializer} = descriptor;
|
||||
delete descriptor.initializer;
|
||||
@@ -22,4 +22,4 @@ class Example {
|
||||
static prop = 3;
|
||||
}
|
||||
|
||||
assert.equal(Example.prop, "__3__");
|
||||
expect(Example.prop).toBe("__3__");
|
||||
|
||||
@@ -6,5 +6,5 @@ class Example {
|
||||
@dec static prop;
|
||||
}
|
||||
|
||||
assert(Example.hasOwnProperty("prop"));
|
||||
assert.equal(Example.prop, undefined);
|
||||
expect(Example).toHaveProperty("prop");
|
||||
expect(Example.prop).toBe(undefined);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
function dec(target, name, descriptor) {
|
||||
assert(target);
|
||||
assert.equal(typeof name, "string");
|
||||
assert.equal(typeof descriptor, "object");
|
||||
expect(target).toBeTruthy();
|
||||
expect(typeof name).toBe("string");
|
||||
expect(typeof descriptor).toBe("object");
|
||||
|
||||
target.decoratedProps = (target.decoratedProps || []).concat([name]);
|
||||
|
||||
@@ -44,8 +44,8 @@ class Example {
|
||||
|
||||
const inst = new Example();
|
||||
|
||||
assert(Example.hasOwnProperty("decoratedProps"));
|
||||
assert.deepEqual(Example.decoratedProps, [
|
||||
expect(Example).toHaveProperty("decoratedProps");
|
||||
expect(Example.decoratedProps).toEqual([
|
||||
"enumconfwrite",
|
||||
"enumconf",
|
||||
"enumwrite",
|
||||
@@ -58,42 +58,42 @@ assert.deepEqual(Example.decoratedProps, [
|
||||
|
||||
const descs = Object.getOwnPropertyDescriptors(Example);
|
||||
|
||||
assert(descs.enumconfwrite.enumerable);
|
||||
assert(descs.enumconfwrite.writable);
|
||||
assert(descs.enumconfwrite.configurable);
|
||||
assert.equal(Example.enumconfwrite, "__1__");
|
||||
expect(descs.enumconfwrite.enumerable).toBeTruthy();
|
||||
expect(descs.enumconfwrite.writable).toBeTruthy();
|
||||
expect(descs.enumconfwrite.configurable).toBeTruthy();
|
||||
expect(Example.enumconfwrite).toBe("__1__");
|
||||
|
||||
assert(descs.enumconf.enumerable);
|
||||
assert.equal(descs.enumconf.writable, false);
|
||||
assert(descs.enumconf.configurable);
|
||||
assert.equal(Example.enumconf, "__2__");
|
||||
expect(descs.enumconf.enumerable).toBeTruthy();
|
||||
expect(descs.enumconf.writable).toBe(false);
|
||||
expect(descs.enumconf.configurable).toBeTruthy();
|
||||
expect(Example.enumconf).toBe("__2__");
|
||||
|
||||
assert(descs.enumwrite.enumerable);
|
||||
assert(descs.enumwrite.writable);
|
||||
assert.equal(descs.enumwrite.configurable, false);
|
||||
assert.equal(Example.enumwrite, "__3__");
|
||||
expect(descs.enumwrite.enumerable).toBeTruthy();
|
||||
expect(descs.enumwrite.writable).toBeTruthy();
|
||||
expect(descs.enumwrite.configurable).toBe(false);
|
||||
expect(Example.enumwrite).toBe("__3__");
|
||||
|
||||
assert(descs.enum.enumerable);
|
||||
assert.equal(descs.enum.writable, false);
|
||||
assert.equal(descs.enum.configurable, false);
|
||||
assert.equal(Example.enum, "__4__");
|
||||
expect(descs.enum.enumerable).toBeTruthy();
|
||||
expect(descs.enum.writable).toBe(false);
|
||||
expect(descs.enum.configurable).toBe(false);
|
||||
expect(Example.enum).toBe("__4__");
|
||||
|
||||
assert.equal(descs.confwrite.enumerable, false);
|
||||
assert(descs.confwrite.writable);
|
||||
assert(descs.confwrite.configurable);
|
||||
assert.equal(Example.confwrite, "__5__");
|
||||
expect(descs.confwrite.enumerable).toBe(false);
|
||||
expect(descs.confwrite.writable).toBeTruthy();
|
||||
expect(descs.confwrite.configurable).toBeTruthy();
|
||||
expect(Example.confwrite).toBe("__5__");
|
||||
|
||||
assert.equal(descs.conf.enumerable, false);
|
||||
assert.equal(descs.conf.writable, false);
|
||||
assert(descs.conf.configurable);
|
||||
assert.equal(Example.conf, "__6__");
|
||||
expect(descs.conf.enumerable).toBe(false);
|
||||
expect(descs.conf.writable).toBe(false);
|
||||
expect(descs.conf.configurable);
|
||||
expect(Example.conf).toBe("__6__");
|
||||
|
||||
assert.equal(descs.write.enumerable, false);
|
||||
assert(descs.write.writable);
|
||||
assert.equal(descs.write.configurable, false);
|
||||
assert.equal(Example.write, "__7__");
|
||||
expect(descs.write.enumerable).toBe(false);
|
||||
expect(descs.write.writable).toBeTruthy();
|
||||
expect(descs.write.configurable).toBe(false);
|
||||
expect(Example.write).toBe("__7__");
|
||||
|
||||
assert.equal(descs._.enumerable, false);
|
||||
assert.equal(descs._.writable, false);
|
||||
assert.equal(descs._.configurable, false);
|
||||
assert.equal(Example._, "__8__");
|
||||
expect(descs._.enumerable).toBe(false);
|
||||
expect(descs._.writable).toBe(false);
|
||||
expect(descs._.configurable).toBe(false);
|
||||
expect(Example._).toBe("__8__");
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
function dec(target, name, descriptor) {
|
||||
assert(target);
|
||||
assert.equal(typeof name, "string");
|
||||
assert.equal(typeof descriptor, "object");
|
||||
expect(target).toBeTruthy();
|
||||
expect(typeof name).toBe("string");
|
||||
expect(typeof descriptor).toBe("object");
|
||||
|
||||
target.decoratedProps = (target.decoratedProps || []).concat([name]);
|
||||
|
||||
@@ -58,8 +58,8 @@ const inst = {
|
||||
},
|
||||
}
|
||||
|
||||
assert(inst.hasOwnProperty('decoratedProps'));
|
||||
assert.deepEqual(inst.decoratedProps, [
|
||||
expect(inst).toHaveProperty('decoratedProps');
|
||||
expect(inst.decoratedProps).toEqual([
|
||||
"enumconfwrite",
|
||||
"enumconf",
|
||||
"enumwrite",
|
||||
@@ -72,42 +72,42 @@ assert.deepEqual(inst.decoratedProps, [
|
||||
|
||||
const descs = Object.getOwnPropertyDescriptors(inst);
|
||||
|
||||
assert(descs.enumconfwrite.enumerable);
|
||||
assert(descs.enumconfwrite.writable);
|
||||
assert(descs.enumconfwrite.configurable);
|
||||
assert.equal(inst.enumconfwrite(), "__1__");
|
||||
expect(descs.enumconfwrite.enumerable).toBeTruthy();
|
||||
expect(descs.enumconfwrite.writable).toBeTruthy();
|
||||
expect(descs.enumconfwrite.configurable).toBeTruthy();
|
||||
expect(inst.enumconfwrite()).toBe("__1__");
|
||||
|
||||
assert(descs.enumconf.enumerable);
|
||||
assert.equal(descs.enumconf.writable, false);
|
||||
assert(descs.enumconf.configurable);
|
||||
assert.equal(inst.enumconf(), "__2__");
|
||||
expect(descs.enumconf.enumerable).toBeTruthy();
|
||||
expect(descs.enumconf.writable).toBe(false);
|
||||
expect(descs.enumconf.configurable).toBeTruthy();
|
||||
expect(inst.enumconf()).toBe("__2__");
|
||||
|
||||
assert(descs.enumwrite.enumerable);
|
||||
assert(descs.enumwrite.writable);
|
||||
assert.equal(descs.enumwrite.configurable, false);
|
||||
assert.equal(inst.enumwrite(), "__3__");
|
||||
expect(descs.enumwrite.enumerable).toBeTruthy();
|
||||
expect(descs.enumwrite.writable).toBeTruthy();
|
||||
expect(descs.enumwrite.configurable).toBe(false);
|
||||
expect(inst.enumwrite()).toBe("__3__");
|
||||
|
||||
assert(descs.enum.enumerable);
|
||||
assert.equal(descs.enum.writable, false);
|
||||
assert.equal(descs.enum.configurable, false);
|
||||
assert.equal(inst.enum(), "__4__");
|
||||
expect(descs.enum.enumerable).toBeTruthy();
|
||||
expect(descs.enum.writable).toBe(false);
|
||||
expect(descs.enum.configurable).toBe(false);
|
||||
expect(inst.enum()).toBe("__4__");
|
||||
|
||||
assert.equal(descs.confwrite.enumerable, false);
|
||||
assert(descs.confwrite.writable);
|
||||
assert(descs.confwrite.configurable);
|
||||
assert.equal(inst.confwrite(), "__5__");
|
||||
expect(descs.confwrite.enumerable).toBe(false);
|
||||
expect(descs.confwrite.writable).toBeTruthy();
|
||||
expect(descs.confwrite.configurable);
|
||||
expect(inst.confwrite()).toBe("__5__");
|
||||
|
||||
assert.equal(descs.conf.enumerable, false);
|
||||
assert.equal(descs.conf.writable, false);
|
||||
assert(descs.conf.configurable);
|
||||
assert.equal(inst.conf(), "__6__");
|
||||
expect(descs.conf.enumerable).toBe(false);
|
||||
expect(descs.conf.writable).toBe(false);
|
||||
expect(descs.conf.configurable).toBeTruthy();
|
||||
expect(inst.conf()).toBe("__6__");
|
||||
|
||||
assert.equal(descs.write.enumerable, false);
|
||||
assert(descs.write.writable);
|
||||
assert.equal(descs.write.configurable, false);
|
||||
assert.equal(inst.write(), "__7__");
|
||||
expect(descs.write.enumerable).toBe(false);
|
||||
expect(descs.write.writable).toBeTruthy();
|
||||
expect(descs.write.configurable).toBe(false);
|
||||
expect(inst.write()).toBe("__7__");
|
||||
|
||||
assert.equal(descs._.enumerable, false);
|
||||
assert.equal(descs._.writable, false);
|
||||
assert.equal(descs._.configurable, false);
|
||||
assert.equal(inst._(), "__8__");
|
||||
expect(descs._.enumerable).toBe(false);
|
||||
expect(descs._.writable).toBe(false);
|
||||
expect(descs._.configurable).toBe(false);
|
||||
expect(inst._()).toBe("__8__");
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
function dec(target, name, descriptor){
|
||||
assert(target);
|
||||
assert.equal(name, 4);
|
||||
assert.equal(typeof descriptor, "object");
|
||||
expect(target).toBeTruthy();
|
||||
expect(name).toBe(4);
|
||||
expect(typeof descriptor).toBe("object");
|
||||
}
|
||||
|
||||
const inst = {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
function dec(target, name, descriptor) {
|
||||
assert(target);
|
||||
assert.equal(typeof name, "string");
|
||||
assert.equal(typeof descriptor, "object");
|
||||
expect(target).toBeTruthy();
|
||||
expect(typeof name).toBe("string");
|
||||
expect(typeof descriptor).toBe("object");
|
||||
|
||||
target.decoratedProps = (target.decoratedProps || []).concat([name]);
|
||||
|
||||
@@ -58,8 +58,8 @@ const inst = {
|
||||
},
|
||||
}
|
||||
|
||||
assert(inst.hasOwnProperty('decoratedProps'));
|
||||
assert.deepEqual(inst.decoratedProps, [
|
||||
expect(inst).toHaveProperty('decoratedProps');
|
||||
expect(inst.decoratedProps).toEqual([
|
||||
"enumconfwrite",
|
||||
"enumconf",
|
||||
"enumwrite",
|
||||
@@ -72,42 +72,42 @@ assert.deepEqual(inst.decoratedProps, [
|
||||
|
||||
const descs = Object.getOwnPropertyDescriptors(inst);
|
||||
|
||||
assert(descs.enumconfwrite.enumerable);
|
||||
assert(descs.enumconfwrite.writable);
|
||||
assert(descs.enumconfwrite.configurable);
|
||||
assert.equal(inst.enumconfwrite(), "__1__");
|
||||
expect(descs.enumconfwrite.enumerable).toBeTruthy();
|
||||
expect(descs.enumconfwrite.writable).toBeTruthy();
|
||||
expect(descs.enumconfwrite.configurable).toBeTruthy();
|
||||
expect(inst.enumconfwrite()).toBe("__1__");
|
||||
|
||||
assert(descs.enumconf.enumerable);
|
||||
assert.equal(descs.enumconf.writable, false);
|
||||
assert(descs.enumconf.configurable);
|
||||
assert.equal(inst.enumconf(), "__2__");
|
||||
expect(descs.enumconf.enumerable).toBeTruthy();
|
||||
expect(descs.enumconf.writable).toBe(false);
|
||||
expect(descs.enumconf.configurable).toBeTruthy();
|
||||
expect(inst.enumconf()).toBe("__2__");
|
||||
|
||||
assert(descs.enumwrite.enumerable);
|
||||
assert(descs.enumwrite.writable);
|
||||
assert.equal(descs.enumwrite.configurable, false);
|
||||
assert.equal(inst.enumwrite(), "__3__");
|
||||
expect(descs.enumwrite.enumerable).toBeTruthy();
|
||||
expect(descs.enumwrite.writable).toBeTruthy();
|
||||
expect(descs.enumwrite.configurable).toBe(false);
|
||||
expect(inst.enumwrite()).toBe("__3__");
|
||||
|
||||
assert(descs.enum.enumerable);
|
||||
assert.equal(descs.enum.writable, false);
|
||||
assert.equal(descs.enum.configurable, false);
|
||||
assert.equal(inst.enum(), "__4__");
|
||||
expect(descs.enum.enumerable).toBeTruthy();
|
||||
expect(descs.enum.writable).toBe(false);
|
||||
expect(descs.enum.configurable).toBe(false);
|
||||
expect(inst.enum()).toBe("__4__");
|
||||
|
||||
assert.equal(descs.confwrite.enumerable, false);
|
||||
assert(descs.confwrite.writable);
|
||||
assert(descs.confwrite.configurable);
|
||||
assert.equal(inst.confwrite(), "__5__");
|
||||
expect(descs.confwrite.enumerable).toBe(false);
|
||||
expect(descs.confwrite.writable).toBeTruthy();
|
||||
expect(descs.confwrite.configurable).toBeTruthy();
|
||||
expect(inst.confwrite()).toBe("__5__");
|
||||
|
||||
assert.equal(descs.conf.enumerable, false);
|
||||
assert.equal(descs.conf.writable, false);
|
||||
assert(descs.conf.configurable);
|
||||
assert.equal(inst.conf(), "__6__");
|
||||
expect(descs.conf.enumerable).toBe(false);
|
||||
expect(descs.conf.writable).toBe(false);
|
||||
expect(descs.conf.configurable).toBeTruthy();
|
||||
expect(inst.conf()).toBe("__6__");
|
||||
|
||||
assert.equal(descs.write.enumerable, false);
|
||||
assert(descs.write.writable);
|
||||
assert.equal(descs.write.configurable, false);
|
||||
assert.equal(inst.write(), "__7__");
|
||||
expect(descs.write.enumerable).toBe(false);
|
||||
expect(descs.write.writable).toBeTruthy();
|
||||
expect(descs.write.configurable).toBe(false);
|
||||
expect(inst.write()).toBe("__7__");
|
||||
|
||||
assert.equal(descs._.enumerable, false);
|
||||
assert.equal(descs._.writable, false);
|
||||
assert.equal(descs._.configurable, false);
|
||||
assert.equal(inst._(), "__8__");
|
||||
expect(descs._.enumerable).toBe(false);
|
||||
expect(descs._.writable).toBe(false);
|
||||
expect(descs._.configurable).toBe(false);
|
||||
expect(inst._()).toBe("__8__");
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
function dec(target, name, descriptor){
|
||||
assert(target);
|
||||
assert.equal(name, "str");
|
||||
assert.equal(typeof descriptor, "object");
|
||||
expect(target).toBeTruthy();
|
||||
expect(name).toBe("str");
|
||||
expect(typeof descriptor).toBe("object");
|
||||
}
|
||||
|
||||
const inst = {
|
||||
|
||||
@@ -22,4 +22,4 @@ const obj = {
|
||||
prop2: 2,
|
||||
}
|
||||
|
||||
assert.deepEqual(calls, [1, 2, 3, 4, 5, 6, 7, 8]);
|
||||
expect(calls).toEqual([1, 2, 3, 4, 5, 6, 7, 8]);
|
||||
|
||||
@@ -23,4 +23,4 @@ const obj = {
|
||||
prop2: 2,
|
||||
}
|
||||
|
||||
assert.deepEqual(calls, [1, 2, 3, 4, 5, 6, 7, 8]);
|
||||
expect(calls).toEqual([1, 2, 3, 4, 5, 6, 7, 8]);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
function dec(target, name, descriptor) {
|
||||
assert(target);
|
||||
assert.equal(typeof name, "string");
|
||||
assert.equal(typeof descriptor, "object");
|
||||
expect(target).toBeTruthy();
|
||||
expect(typeof name).toBe("string");
|
||||
expect(typeof descriptor).toBe("object");
|
||||
|
||||
target.decoratedProps = (target.decoratedProps || []).concat([name]);
|
||||
|
||||
@@ -43,8 +43,8 @@ const inst = {
|
||||
};
|
||||
|
||||
|
||||
assert(inst.hasOwnProperty("decoratedProps"));
|
||||
assert.deepEqual(inst.decoratedProps, [
|
||||
expect(inst).toHaveProperty("decoratedProps");
|
||||
expect(inst.decoratedProps).toEqual([
|
||||
"enumconfwrite",
|
||||
"enumconf",
|
||||
"enumwrite",
|
||||
@@ -57,42 +57,42 @@ assert.deepEqual(inst.decoratedProps, [
|
||||
|
||||
const descs = Object.getOwnPropertyDescriptors(inst);
|
||||
|
||||
assert(descs.enumconfwrite.enumerable);
|
||||
assert(descs.enumconfwrite.writable);
|
||||
assert(descs.enumconfwrite.configurable);
|
||||
assert.equal(inst.enumconfwrite, "__1__");
|
||||
expect(descs.enumconfwrite.enumerable).toBeTruthy();
|
||||
expect(descs.enumconfwrite.writable).toBeTruthy();
|
||||
expect(descs.enumconfwrite.configurable).toBeTruthy();
|
||||
expect(inst.enumconfwrite).toBe("__1__");
|
||||
|
||||
assert(descs.enumconf.enumerable);
|
||||
assert.equal(descs.enumconf.writable, false);
|
||||
assert(descs.enumconf.configurable);
|
||||
assert.equal(inst.enumconf, "__2__");
|
||||
expect(descs.enumconf.enumerable).toBeTruthy();
|
||||
expect(descs.enumconf.writable).toBe(false);
|
||||
expect(descs.enumconf.configurable).toBeTruthy();
|
||||
expect(inst.enumconf).toBe("__2__");
|
||||
|
||||
assert(descs.enumwrite.enumerable);
|
||||
assert(descs.enumwrite.writable);
|
||||
assert.equal(descs.enumwrite.configurable, false);
|
||||
assert.equal(inst.enumwrite, "__3__");
|
||||
expect(descs.enumwrite.enumerable).toBeTruthy();
|
||||
expect(descs.enumwrite.writable).toBeTruthy();
|
||||
expect(descs.enumwrite.configurable).toBe(false);
|
||||
expect(inst.enumwrite).toBe("__3__");
|
||||
|
||||
assert(descs.enum.enumerable);
|
||||
assert.equal(descs.enum.writable, false);
|
||||
assert.equal(descs.enum.configurable, false);
|
||||
assert.equal(inst.enum, "__4__");
|
||||
expect(descs.enum.enumerable).toBeTruthy();
|
||||
expect(descs.enum.writable).toBe(false);
|
||||
expect(descs.enum.configurable).toBe(false);
|
||||
expect(inst.enum).toBe("__4__");
|
||||
|
||||
assert.equal(descs.confwrite.enumerable, false);
|
||||
assert(descs.confwrite.writable);
|
||||
assert(descs.confwrite.configurable);
|
||||
assert.equal(inst.confwrite, "__5__");
|
||||
expect(descs.confwrite.enumerable).toBe(false);
|
||||
expect(descs.confwrite.writable).toBeTruthy();
|
||||
expect(descs.confwrite.configurable).toBeTruthy();
|
||||
expect(inst.confwrite).toBe("__5__");
|
||||
|
||||
assert.equal(descs.conf.enumerable, false);
|
||||
assert.equal(descs.conf.writable, false);
|
||||
assert(descs.conf.configurable);
|
||||
assert.equal(inst.conf, "__6__");
|
||||
expect(descs.conf.enumerable).toBe(false);
|
||||
expect(descs.conf.writable).toBe(false);
|
||||
expect(descs.conf.configurable).toBeTruthy();
|
||||
expect(inst.conf).toBe("__6__");
|
||||
|
||||
assert.equal(descs.write.enumerable, false);
|
||||
assert(descs.write.writable);
|
||||
assert.equal(descs.write.configurable, false);
|
||||
assert.equal(inst.write, "__7__");
|
||||
expect(descs.write.enumerable).toBe(false);
|
||||
expect(descs.write.writable).toBeTruthy();
|
||||
expect(descs.write.configurable).toBe(false);
|
||||
expect(inst.write).toBe("__7__");
|
||||
|
||||
assert.equal(descs._.enumerable, false);
|
||||
assert.equal(descs._.writable, false);
|
||||
assert.equal(descs._.configurable, false);
|
||||
assert.equal(inst._, "__8__");
|
||||
expect(descs._.enumerable).toBe(false);
|
||||
expect(descs._.writable).toBe(false);
|
||||
expect(descs._.configurable).toBe(false);
|
||||
expect(inst._).toBe("__8__");
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
function dec(target, name, descriptor){
|
||||
assert(target);
|
||||
assert.equal(name, "prop");
|
||||
assert.equal(typeof descriptor, "object");
|
||||
expect(target).toBeTruthy();
|
||||
expect(name).toBe("prop");
|
||||
expect(typeof descriptor).toBe("object");
|
||||
|
||||
let {initializer} = descriptor;
|
||||
delete descriptor.initializer;
|
||||
@@ -22,4 +22,4 @@ let inst = {
|
||||
prop: 3
|
||||
};
|
||||
|
||||
assert.equal(inst.prop, "__3__");
|
||||
expect(inst.prop).toBe("__3__");
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
function dec(target, name, descriptor){
|
||||
assert(target);
|
||||
assert.equal(name, 4);
|
||||
assert.equal(typeof descriptor, "object");
|
||||
expect(target).toBeTruthy();
|
||||
expect(name).toBe(4);
|
||||
expect(typeof descriptor).toBe("object");
|
||||
}
|
||||
|
||||
const inst = {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
function dec(target, name, descriptor) {
|
||||
assert(target);
|
||||
assert.equal(typeof name, "string");
|
||||
assert.equal(typeof descriptor, "object");
|
||||
expect(target).toBeTruthy();
|
||||
expect(typeof name).toBe("string");
|
||||
expect(typeof descriptor).toBe("object");
|
||||
|
||||
target.decoratedProps = (target.decoratedProps || []).concat([name]);
|
||||
|
||||
@@ -42,8 +42,8 @@ const inst = {
|
||||
_: 8,
|
||||
};
|
||||
|
||||
assert(inst.hasOwnProperty("decoratedProps"));
|
||||
assert.deepEqual(inst.decoratedProps, [
|
||||
expect(inst).toHaveProperty("decoratedProps");
|
||||
expect(inst.decoratedProps).toEqual([
|
||||
"enumconfwrite",
|
||||
"enumconf",
|
||||
"enumwrite",
|
||||
@@ -56,42 +56,42 @@ assert.deepEqual(inst.decoratedProps, [
|
||||
|
||||
const descs = Object.getOwnPropertyDescriptors(inst);
|
||||
|
||||
assert(descs.enumconfwrite.enumerable);
|
||||
assert(descs.enumconfwrite.writable);
|
||||
assert(descs.enumconfwrite.configurable);
|
||||
assert.equal(inst.enumconfwrite, "__1__");
|
||||
expect(descs.enumconfwrite.enumerable).toBeTruthy();
|
||||
expect(descs.enumconfwrite.writable).toBeTruthy();
|
||||
expect(descs.enumconfwrite.configurable).toBeTruthy();
|
||||
expect(inst.enumconfwrite).toBe("__1__");
|
||||
|
||||
assert(descs.enumconf.enumerable);
|
||||
assert.equal(descs.enumconf.writable, false);
|
||||
assert(descs.enumconf.configurable);
|
||||
assert.equal(inst.enumconf, "__2__");
|
||||
expect(descs.enumconf.enumerable).toBeTruthy();
|
||||
expect(descs.enumconf.writable).toBe(false);
|
||||
expect(descs.enumconf.configurable).toBeTruthy();
|
||||
expect(inst.enumconf).toBe("__2__");
|
||||
|
||||
assert(descs.enumwrite.enumerable);
|
||||
assert(descs.enumwrite.writable);
|
||||
assert.equal(descs.enumwrite.configurable, false);
|
||||
assert.equal(inst.enumwrite, "__3__");
|
||||
expect(descs.enumwrite.enumerable).toBeTruthy();
|
||||
expect(descs.enumwrite.writable).toBeTruthy();
|
||||
expect(descs.enumwrite.configurable).toBe(false);
|
||||
expect(inst.enumwrite).toBe("__3__");
|
||||
|
||||
assert(descs.enum.enumerable);
|
||||
assert.equal(descs.enum.writable, false);
|
||||
assert.equal(descs.enum.configurable, false);
|
||||
assert.equal(inst.enum, "__4__");
|
||||
expect(descs.enum.enumerable).toBeTruthy();
|
||||
expect(descs.enum.writable).toBe(false);
|
||||
expect(descs.enum.configurable).toBe(false);
|
||||
expect(inst.enum).toBe("__4__");
|
||||
|
||||
assert.equal(descs.confwrite.enumerable, false);
|
||||
assert(descs.confwrite.writable);
|
||||
assert(descs.confwrite.configurable);
|
||||
assert.equal(inst.confwrite, "__5__");
|
||||
expect(descs.confwrite.enumerable).toBe(false);
|
||||
expect(descs.confwrite.writable).toBeTruthy();
|
||||
expect(descs.confwrite.configurable).toBeTruthy();
|
||||
expect(inst.confwrite).toBe("__5__");
|
||||
|
||||
assert.equal(descs.conf.enumerable, false);
|
||||
assert.equal(descs.conf.writable, false);
|
||||
assert(descs.conf.configurable);
|
||||
assert.equal(inst.conf, "__6__");
|
||||
expect(descs.conf.enumerable).toBe(false);
|
||||
expect(descs.conf.writable).toBe(false);
|
||||
expect(descs.conf.configurable).toBeTruthy();
|
||||
expect(inst.conf).toBe("__6__");
|
||||
|
||||
assert.equal(descs.write.enumerable, false);
|
||||
assert(descs.write.writable);
|
||||
assert.equal(descs.write.configurable, false);
|
||||
assert.equal(inst.write, "__7__");
|
||||
expect(descs.write.enumerable).toBe(false);
|
||||
expect(descs.write.writable).toBeTruthy();
|
||||
expect(descs.write.configurable).toBe(false);
|
||||
expect(inst.write).toBe("__7__");
|
||||
|
||||
assert.equal(descs._.enumerable, false);
|
||||
assert.equal(descs._.writable, false);
|
||||
assert.equal(descs._.configurable, false);
|
||||
assert.equal(inst._, "__8__");
|
||||
expect(descs._.enumerable).toBe(false);
|
||||
expect(descs._.writable).toBe(false);
|
||||
expect(descs._.configurable).toBe(false);
|
||||
expect(inst._).toBe("__8__");
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
function dec(target, name, descriptor){
|
||||
assert(target);
|
||||
assert.equal(name, "str");
|
||||
assert.equal(typeof descriptor, "object");
|
||||
expect(target).toBeTruthy();
|
||||
expect(name).toBe("str");
|
||||
expect(typeof descriptor).toBe("object");
|
||||
}
|
||||
|
||||
const inst = {
|
||||
|
||||
@@ -4,7 +4,7 @@ let a = 1;
|
||||
|
||||
(do {
|
||||
let a = 2;
|
||||
assert.equal(a, 2);
|
||||
expect(a).toBe(2);
|
||||
});
|
||||
assert.equal(a, 1);
|
||||
expect(a).toBe(1);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
assert.equal(do {
|
||||
expect(do {
|
||||
var i = 5;
|
||||
do { i--; } while(i > 3);
|
||||
i;
|
||||
}, 3);
|
||||
}).toBe(3);
|
||||
|
||||
@@ -1 +1 @@
|
||||
assert.equal(do {}, undefined);
|
||||
expect(do {}).toBeUndefined();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
assert.equal(do {
|
||||
expect(do {
|
||||
var obj = { foo: "bar", bar: "foo" };
|
||||
for (var key in obj) {
|
||||
obj[key];
|
||||
}
|
||||
}, "foo");
|
||||
}).toBe("foo");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
assert.equal(do {
|
||||
expect(do {
|
||||
for (var i = 0; i < 5; i++) {
|
||||
i;
|
||||
}
|
||||
}, 4);
|
||||
}).toBe(4);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
assert.equal(do {
|
||||
expect(do {
|
||||
if (false) {
|
||||
"foo";
|
||||
} else if (true) {
|
||||
"bar";
|
||||
}
|
||||
}, "bar");
|
||||
}).toBe("bar");
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
assert.equal(do {
|
||||
expect(do {
|
||||
if (false) {
|
||||
"foo";
|
||||
} else {
|
||||
"bar";
|
||||
}
|
||||
}, "bar");
|
||||
}).toBe("bar");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
assert.equal(do {
|
||||
expect(do {
|
||||
if (true) {
|
||||
"bar";
|
||||
}
|
||||
}, "bar");
|
||||
}).toBe("bar");
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
assert.equal(do {
|
||||
expect(do {
|
||||
"foo";
|
||||
}, "foo");
|
||||
}).toBe("foo");
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
assert.equal(do {
|
||||
expect(do {
|
||||
var bar = "foo";
|
||||
}, undefined);
|
||||
}).toBeUndefined();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
assert.equal(do {
|
||||
expect(do {
|
||||
var bar = "foo";
|
||||
bar;
|
||||
}, "foo");
|
||||
}).toBe("foo");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
assert.equal(do {
|
||||
expect(do {
|
||||
var i = 5;
|
||||
while (i > 3) i--;
|
||||
i;
|
||||
}, 3);
|
||||
}).toBe(3);
|
||||
|
||||
@@ -19,7 +19,7 @@ var lib = {};
|
||||
::lib.g()
|
||||
::lib.h();
|
||||
|
||||
assert.deepEqual(operations, [
|
||||
expect(operations).toEqual([
|
||||
'get lib.f',
|
||||
'lib.f()',
|
||||
'get lib.g',
|
||||
|
||||
@@ -9,5 +9,5 @@ const it = gen();
|
||||
it.next(1);
|
||||
it.next(2);
|
||||
|
||||
assert.equal(sent, 1);
|
||||
assert.equal(yielded, 2);
|
||||
expect(sent).toBe(1);
|
||||
expect(yielded).toBe(2);
|
||||
|
||||
@@ -11,13 +11,13 @@ function* gen() {
|
||||
}
|
||||
|
||||
const it = gen();
|
||||
assert.deepEqual(values, []);
|
||||
expect(values).toEqual([]);
|
||||
|
||||
assert.equal(it.next(1).value, "foo");
|
||||
assert.deepEqual(values, [ 1, 1 ]);
|
||||
expect(it.next(1).value).toBe("foo");
|
||||
expect(values).toEqual([ 1, 1 ]);
|
||||
|
||||
assert.equal(it.next(2).value, undefined);
|
||||
assert.deepEqual(values, [ 1, 1, 2, 2 ]);
|
||||
expect(it.next(2).value).toBeUndefined();
|
||||
expect(values).toEqual([ 1, 1, 2, 2 ]);
|
||||
|
||||
assert.equal(it.next(3).done, true);
|
||||
assert.deepEqual(values, [ 1, 1, 2, 2, 3, 3, 3 ]);
|
||||
expect(it.next(3).done).toBe(true);
|
||||
expect(values).toEqual([ 1, 1, 2, 2, 3, 3, 3 ]);
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
var x = 0;
|
||||
var sets = 0;
|
||||
var obj = {
|
||||
get x() {
|
||||
return x;
|
||||
},
|
||||
|
||||
set x(value) {
|
||||
sets++;
|
||||
x = value;
|
||||
},
|
||||
};
|
||||
|
||||
assert.equal(obj.x ||= 1, 1);
|
||||
assert.equal(sets, 1);
|
||||
assert.equal(obj.x ||= 2, 1);
|
||||
assert.equal(sets, 1);
|
||||
|
||||
assert.equal(obj.x &&= 0, 0);
|
||||
assert.equal(sets, 2);
|
||||
assert.equal(obj.x &&= 3, 0);
|
||||
assert.equal(sets, 2);
|
||||
|
||||
var gets = 0;
|
||||
var deep = {
|
||||
get obj() {
|
||||
gets++;
|
||||
return obj;
|
||||
},
|
||||
};
|
||||
|
||||
assert.equal(deep.obj.x ||= 1, 1);
|
||||
assert.equal(gets, 1);
|
||||
assert.equal(deep.obj.x ||= 2, 1);
|
||||
assert.equal(gets, 2);
|
||||
|
||||
assert.equal(deep.obj.x &&= 0, 0);
|
||||
assert.equal(gets, 3);
|
||||
assert.equal(deep.obj.x &&= 3, 0);
|
||||
assert.equal(gets, 4);
|
||||
|
||||
var key = 0;
|
||||
assert.equal(obj[++key] ||= 1, 1);
|
||||
assert.equal(key, 1);
|
||||
key = 0;
|
||||
assert.equal(obj[++key] ||= 2, 1);
|
||||
assert.equal(key, 1);
|
||||
|
||||
key = 0;
|
||||
assert.equal(obj[++key] &&= 0, 0);
|
||||
assert.equal(key, 1);
|
||||
key = 0;
|
||||
assert.equal(obj[++key] &&= 3, 0);
|
||||
assert.equal(key, 1);
|
||||
|
||||
key = 0;
|
||||
assert.equal(deep.obj[++key] ||= 1, 1);
|
||||
assert.equal(gets, 5);
|
||||
assert.equal(key, 1);
|
||||
key = 0;
|
||||
assert.equal(deep.obj[++key] ||= 2, 1);
|
||||
assert.equal(gets, 6);
|
||||
assert.equal(key, 1);
|
||||
|
||||
key = 0;
|
||||
assert.equal(deep.obj[++key] &&= 0, 0);
|
||||
assert.equal(gets, 7);
|
||||
assert.equal(key, 1);
|
||||
key = 0;
|
||||
assert.equal(deep.obj[++key] &&= 3, 0);
|
||||
assert.equal(gets, 8);
|
||||
assert.equal(key, 1);
|
||||
@@ -11,15 +11,15 @@ var obj = {
|
||||
},
|
||||
};
|
||||
|
||||
assert.equal(obj.x ||= 1, 1);
|
||||
assert.equal(sets, 1);
|
||||
assert.equal(obj.x ||= 2, 1);
|
||||
assert.equal(sets, 1);
|
||||
expect(obj.x ||= 1).toBe(1);
|
||||
expect(sets).toBe(1);
|
||||
expect(obj.x ||= 2).toBe(1);
|
||||
expect(sets).toBe(1);
|
||||
|
||||
assert.equal(obj.x &&= 0, 0);
|
||||
assert.equal(sets, 2);
|
||||
assert.equal(obj.x &&= 3, 0);
|
||||
assert.equal(sets, 2);
|
||||
expect(obj.x &&= 0).toBe(0);
|
||||
expect(sets).toBe(2);
|
||||
expect(obj.x &&= 3).toBe(0);
|
||||
expect(sets).toBe(2);
|
||||
|
||||
var gets = 0;
|
||||
var deep = {
|
||||
@@ -29,44 +29,44 @@ var deep = {
|
||||
},
|
||||
};
|
||||
|
||||
assert.equal(deep.obj.x ||= 1, 1);
|
||||
assert.equal(gets, 1);
|
||||
assert.equal(deep.obj.x ||= 2, 1);
|
||||
assert.equal(gets, 2);
|
||||
expect(deep.obj.x ||= 1).toBe(1);
|
||||
expect(gets).toBe(1);
|
||||
expect(deep.obj.x ||= 2).toBe(1);
|
||||
expect(gets).toBe(2);
|
||||
|
||||
assert.equal(deep.obj.x &&= 0, 0);
|
||||
assert.equal(gets, 3);
|
||||
assert.equal(deep.obj.x &&= 3, 0);
|
||||
assert.equal(gets, 4);
|
||||
expect(deep.obj.x &&= 0).toBe(0);
|
||||
expect(gets).toBe(3);
|
||||
expect(deep.obj.x &&= 3).toBe(0);
|
||||
expect(gets).toBe(4);
|
||||
|
||||
var key = 0;
|
||||
assert.equal(obj[++key] ||= 1, 1);
|
||||
assert.equal(key, 1);
|
||||
expect(obj[++key] ||= 1).toBe(1);
|
||||
expect(key).toBe(1);
|
||||
key = 0;
|
||||
assert.equal(obj[++key] ||= 2, 1);
|
||||
assert.equal(key, 1);
|
||||
expect(obj[++key] ||= 2).toBe(1);
|
||||
expect(key).toBe(1);
|
||||
|
||||
key = 0;
|
||||
assert.equal(obj[++key] &&= 0, 0);
|
||||
assert.equal(key, 1);
|
||||
expect(obj[++key] &&= 0).toBe(0);
|
||||
expect(key).toBe(1);
|
||||
key = 0;
|
||||
assert.equal(obj[++key] &&= 3, 0);
|
||||
assert.equal(key, 1);
|
||||
expect(obj[++key] &&= 3).toBe(0);
|
||||
expect(key).toBe(1);
|
||||
|
||||
key = 0;
|
||||
assert.equal(deep.obj[++key] ||= 1, 1);
|
||||
assert.equal(gets, 5);
|
||||
assert.equal(key, 1);
|
||||
expect(deep.obj[++key] ||= 1).toBe(1);
|
||||
expect(gets).toBe(5);
|
||||
expect(key).toBe(1);
|
||||
key = 0;
|
||||
assert.equal(deep.obj[++key] ||= 2, 1);
|
||||
assert.equal(gets, 6);
|
||||
assert.equal(key, 1);
|
||||
expect(deep.obj[++key] ||= 2).toBe(1);
|
||||
expect(gets).toBe(6);
|
||||
expect(key).toBe(1);
|
||||
|
||||
key = 0;
|
||||
assert.equal(deep.obj[++key] &&= 0, 0);
|
||||
assert.equal(gets, 7);
|
||||
assert.equal(key, 1);
|
||||
expect(deep.obj[++key] &&= 0).toBe(0);
|
||||
expect(gets).toBe(7);
|
||||
expect(key).toBe(1);
|
||||
key = 0;
|
||||
assert.equal(deep.obj[++key] &&= 3, 0);
|
||||
assert.equal(gets, 8);
|
||||
assert.equal(key, 1);
|
||||
expect(deep.obj[++key] &&= 3).toBe(0);
|
||||
expect(gets).toBe(8);
|
||||
expect(key).toBe(1);
|
||||
|
||||
@@ -13,14 +13,14 @@ var obj = {
|
||||
}
|
||||
|
||||
};
|
||||
assert.equal(obj.x || (obj.x = 1), 1);
|
||||
assert.equal(sets, 1);
|
||||
assert.equal(obj.x || (obj.x = 2), 1);
|
||||
assert.equal(sets, 1);
|
||||
assert.equal(obj.x && (obj.x = 0), 0);
|
||||
assert.equal(sets, 2);
|
||||
assert.equal(obj.x && (obj.x = 3), 0);
|
||||
assert.equal(sets, 2);
|
||||
expect(obj.x || (obj.x = 1)).toBe(1);
|
||||
expect(sets).toBe(1);
|
||||
expect(obj.x || (obj.x = 2)).toBe(1);
|
||||
expect(sets).toBe(1);
|
||||
expect(obj.x && (obj.x = 0)).toBe(0);
|
||||
expect(sets).toBe(2);
|
||||
expect(obj.x && (obj.x = 3)).toBe(0);
|
||||
expect(sets).toBe(2);
|
||||
var gets = 0;
|
||||
var deep = {
|
||||
get obj() {
|
||||
@@ -29,39 +29,39 @@ var deep = {
|
||||
}
|
||||
|
||||
};
|
||||
assert.equal((_deep$obj = deep.obj).x || (_deep$obj.x = 1), 1);
|
||||
assert.equal(gets, 1);
|
||||
assert.equal((_deep$obj2 = deep.obj).x || (_deep$obj2.x = 2), 1);
|
||||
assert.equal(gets, 2);
|
||||
assert.equal((_deep$obj3 = deep.obj).x && (_deep$obj3.x = 0), 0);
|
||||
assert.equal(gets, 3);
|
||||
assert.equal((_deep$obj4 = deep.obj).x && (_deep$obj4.x = 3), 0);
|
||||
assert.equal(gets, 4);
|
||||
expect((_deep$obj = deep.obj).x || (_deep$obj.x = 1)).toBe(1);
|
||||
expect(gets).toBe(1);
|
||||
expect((_deep$obj2 = deep.obj).x || (_deep$obj2.x = 2)).toBe(1);
|
||||
expect(gets).toBe(2);
|
||||
expect((_deep$obj3 = deep.obj).x && (_deep$obj3.x = 0)).toBe(0);
|
||||
expect(gets).toBe(3);
|
||||
expect((_deep$obj4 = deep.obj).x && (_deep$obj4.x = 3)).toBe(0);
|
||||
expect(gets).toBe(4);
|
||||
var key = 0;
|
||||
assert.equal(obj[_ref = ++key] || (obj[_ref] = 1), 1);
|
||||
assert.equal(key, 1);
|
||||
expect(obj[_ref = ++key] || (obj[_ref] = 1)).toBe(1);
|
||||
expect(key).toBe(1);
|
||||
key = 0;
|
||||
assert.equal(obj[_ref2 = ++key] || (obj[_ref2] = 2), 1);
|
||||
assert.equal(key, 1);
|
||||
expect(obj[_ref2 = ++key] || (obj[_ref2] = 2)).toBe(1);
|
||||
expect(key).toBe(1);
|
||||
key = 0;
|
||||
assert.equal(obj[_ref3 = ++key] && (obj[_ref3] = 0), 0);
|
||||
assert.equal(key, 1);
|
||||
expect(obj[_ref3 = ++key] && (obj[_ref3] = 0)).toBe(0);
|
||||
expect(key).toBe(1);
|
||||
key = 0;
|
||||
assert.equal(obj[_ref4 = ++key] && (obj[_ref4] = 3), 0);
|
||||
assert.equal(key, 1);
|
||||
expect(obj[_ref4 = ++key] && (obj[_ref4] = 3)).toBe(0);
|
||||
expect(key).toBe(1);
|
||||
key = 0;
|
||||
assert.equal((_deep$obj5 = deep.obj)[_ref5 = ++key] || (_deep$obj5[_ref5] = 1), 1);
|
||||
assert.equal(gets, 5);
|
||||
assert.equal(key, 1);
|
||||
expect((_deep$obj5 = deep.obj)[_ref5 = ++key] || (_deep$obj5[_ref5] = 1)).toBe(1);
|
||||
expect(gets).toBe(5);
|
||||
expect(key).toBe(1);
|
||||
key = 0;
|
||||
assert.equal((_deep$obj6 = deep.obj)[_ref6 = ++key] || (_deep$obj6[_ref6] = 2), 1);
|
||||
assert.equal(gets, 6);
|
||||
assert.equal(key, 1);
|
||||
expect((_deep$obj6 = deep.obj)[_ref6 = ++key] || (_deep$obj6[_ref6] = 2)).toBe(1);
|
||||
expect(gets).toBe(6);
|
||||
expect(key).toBe(1);
|
||||
key = 0;
|
||||
assert.equal((_deep$obj7 = deep.obj)[_ref7 = ++key] && (_deep$obj7[_ref7] = 0), 0);
|
||||
assert.equal(gets, 7);
|
||||
assert.equal(key, 1);
|
||||
expect((_deep$obj7 = deep.obj)[_ref7 = ++key] && (_deep$obj7[_ref7] = 0)).toBe(0);
|
||||
expect(gets).toBe(7);
|
||||
expect(key).toBe(1);
|
||||
key = 0;
|
||||
assert.equal((_deep$obj8 = deep.obj)[_ref8 = ++key] && (_deep$obj8[_ref8] = 3), 0);
|
||||
assert.equal(gets, 8);
|
||||
assert.equal(key, 1);
|
||||
expect((_deep$obj8 = deep.obj)[_ref8 = ++key] && (_deep$obj8[_ref8] = 3)).toBe(0);
|
||||
expect(gets).toBe(8);
|
||||
expect(key).toBe(1);
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
assert.equal(null ?? undefined, undefined);
|
||||
assert.equal(undefined ?? null, null);
|
||||
assert.equal(false ?? true, false);
|
||||
assert.equal(0 ?? 1, 0);
|
||||
assert.equal("" ?? "foo", "");
|
||||
expect(null ?? undefined).toBeUndefined(undefined);
|
||||
expect(undefined ?? null).toBeNull();
|
||||
expect(false ?? true).toBe(false);
|
||||
expect(0 ?? 1).toBe(0);
|
||||
expect("" ?? "foo").toBe("");
|
||||
|
||||
var obj = { exists: true };
|
||||
assert.equal(obj.exists ?? false, true);
|
||||
assert.equal(obj.doesNotExist ?? "foo", "foo");
|
||||
expect(obj.exists ?? false).toBe(true);
|
||||
expect(obj.doesNotExist ?? "foo").toBe("foo");
|
||||
|
||||
var counter = 0;
|
||||
function sideEffect() { return counter++; }
|
||||
assert.equal(sideEffect() ?? -1, 0);
|
||||
expect(sideEffect() ?? -1).toBe(0);
|
||||
|
||||
var counter2 = 0;
|
||||
var obj2 = {
|
||||
get foo() { return counter2++; }
|
||||
};
|
||||
assert.equal(obj2.foo ?? -1, 0);
|
||||
expect(obj2.foo ?? -1).toBe(0);
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
assert.equal(Number("1_000"), Number("1000"));
|
||||
assert.equal(Number("0xAE_BE_CE"), Number("0xAEBECE"));
|
||||
assert.equal(Number("0b1010_0001_1000_0101"), Number("0b1010000110000101"));
|
||||
assert.equal(Number("0o0_6_6_6"), Number("0o0666"));
|
||||
expect(Number("1_000")).toBe(Number("1000"));
|
||||
expect(Number("0xAE_BE_CE")).toBe(Number("0xAEBECE"));
|
||||
expect(Number("0b1010_0001_1000_0101")).toBe(Number("0b1010000110000101"));
|
||||
expect(Number("0o0_6_6_6")).toBe(Number("0o0666"));
|
||||
|
||||
assert.equal(new Number("1_000").valueOf(), new Number("1000").valueOf());
|
||||
assert.equal(new Number("0xAE_BE_CE").valueOf(), new Number("0xAEBECE").valueOf());
|
||||
assert.equal(new Number("0b1010_0001_1000_0101").valueOf(), new Number("0b1010000110000101").valueOf());
|
||||
assert.equal(new Number("0o0_6_6_6").valueOf(), new Number("0o0666").valueOf());
|
||||
expect(new Number("1_000").valueOf()).toBe(new Number("1000").valueOf());
|
||||
expect(new Number("0xAE_BE_CE").valueOf()).toBe(new Number("0xAEBECE").valueOf());
|
||||
expect(new Number("0b1010_0001_1000_0101").valueOf()).toBe(new Number("0b1010000110000101").valueOf());
|
||||
expect(new Number("0o0_6_6_6").valueOf()).toBe(new Number("0o0666").valueOf());
|
||||
|
||||
assert.equal(Number(1_000), Number("1000"));
|
||||
assert.equal(Number(0xAE_BE_CE), Number("0xAEBECE"));
|
||||
assert.equal(Number(0b1010_0001_1000_0101), Number("0b1010000110000101"));
|
||||
assert.equal(Number(0o0_6_6_6), Number("0o0666"));
|
||||
expect(Number(1_000)).toBe(Number("1000"));
|
||||
expect(Number(0xAE_BE_CE)).toBe(Number("0xAEBECE"));
|
||||
expect(Number(0b1010_0001_1000_0101)).toBe(Number("0b1010000110000101"));
|
||||
expect(Number(0o0_6_6_6)).toBe(Number("0o0666"));
|
||||
|
||||
assert.equal(new Number(1_000).valueOf(), new Number("1000").valueOf());
|
||||
assert.equal(new Number(0xAE_BE_CE).valueOf(), new Number("0xAEBECE").valueOf());
|
||||
assert.equal(new Number(0b1010_0001_1000_0101).valueOf(), new Number("0b1010000110000101").valueOf());
|
||||
assert.equal(new Number(0o0_6_6_6).valueOf(), new Number("0o0666").valueOf());
|
||||
expect(new Number(1_000).valueOf()).toBe(new Number("1000").valueOf());
|
||||
expect(new Number(0xAE_BE_CE).valueOf()).toBe(new Number("0xAEBECE").valueOf());
|
||||
expect(new Number(0b1010_0001_1000_0101).valueOf()).toBe(new Number("0b1010000110000101").valueOf());
|
||||
expect(new Number(0o0_6_6_6).valueOf()).toBe(new Number("0o0666").valueOf());
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
assert.equal(1_000, 1000);
|
||||
assert.equal(0xAE_BE_CE, 0xAEBECE);
|
||||
assert.equal(0b1010_0001_1000_0101, 0b1010000110000101);
|
||||
assert.equal(0o0_6_6_6, 0o0666);
|
||||
expect(1_000).toBe(1000);
|
||||
expect(0xAE_BE_CE).toBe(0xAEBECE);
|
||||
expect(0b1010_0001_1000_0101).toBe(0b1010000110000101);
|
||||
expect(0o0_6_6_6).toBe(0o0666);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
assert.equal(1_000, 1000);
|
||||
assert.equal(0xAE_BE_CE, 11452110);
|
||||
assert.equal(0b1010_0001_1000_0101, 41349);
|
||||
assert.equal(0o0_6_6_6, 438);
|
||||
expect(1_000).toBe(1000);
|
||||
expect(0xAE_BE_CE).toBe(11452110);
|
||||
expect(0b1010_0001_1000_0101).toBe(41349);
|
||||
expect(0o0_6_6_6).toBe(438);
|
||||
|
||||
@@ -2,20 +2,20 @@ var key, x, y, z;
|
||||
// impure
|
||||
key = 1;
|
||||
var { [key++]: y, ...x } = { 1: 1, a: 1 };
|
||||
assert.deepEqual({ a: 1 }, x);
|
||||
assert.equal(key, 2);
|
||||
assert.equal(1, y);
|
||||
expect(x).toEqual({ a: 1 });
|
||||
expect(key).toBe(2);
|
||||
expect(1).toBe(y);
|
||||
|
||||
// takes care of the order
|
||||
|
||||
key = 1;
|
||||
var { [++key]: y, [++key]: z, ...rest} = {2: 2, 3: 3};
|
||||
assert.equal(y, 2);
|
||||
assert.equal(z, 3);
|
||||
expect(y).toBe(2);
|
||||
expect(z).toBe(3);
|
||||
|
||||
// pure, computed property should remain as-is
|
||||
key = 2;
|
||||
({ [key]: y, z, ...x } = {2: "two", z: "zee"});
|
||||
assert.equal(y, "two");
|
||||
assert.deepEqual(x, {});
|
||||
assert.equal(z, "zee");
|
||||
expect(y).toBe("two");
|
||||
expect(x).toEqual({});
|
||||
expect(z).toBe("zee");
|
||||
|
||||
@@ -2,20 +2,20 @@ var key, x, y, z;
|
||||
// impure
|
||||
key = 1;
|
||||
var { [key++]: y, ...x } = { 1: 1, a: 1 };
|
||||
assert.deepEqual({ a: 1 }, x);
|
||||
assert.equal(key, 2);
|
||||
assert.equal(1, y);
|
||||
expect(x).toEqual({ a: 1 });
|
||||
expect(key).toBe(2);
|
||||
expect(y).toBe(1);
|
||||
|
||||
// takes care of the order
|
||||
|
||||
key = 1;
|
||||
var { [++key]: y, [++key]: z, ...rest} = {2: 2, 3: 3};
|
||||
assert.equal(y, 2);
|
||||
assert.equal(z, 3);
|
||||
expect(y).toBe(2);
|
||||
expect(z).toBe(3);
|
||||
|
||||
// pure, computed property should remain as-is
|
||||
key = 2;
|
||||
({ [key]: y, z, ...x } = {2: "two", z: "zee"});
|
||||
assert.equal(y, "two");
|
||||
assert.deepEqual(x, {});
|
||||
assert.equal(z, "zee");
|
||||
expect(y).toBe("two");
|
||||
expect(x).toEqual({});
|
||||
expect(z).toBe("zee");
|
||||
|
||||
@@ -12,11 +12,11 @@ var _$a = {
|
||||
} = _$a,
|
||||
x = babelHelpers.objectWithoutProperties(_$a, [_ref].map(babelHelpers.toPropertyKey));
|
||||
|
||||
assert.deepEqual({
|
||||
expect(x).toEqual({
|
||||
a: 1
|
||||
}, x);
|
||||
assert.equal(key, 2);
|
||||
assert.equal(1, y); // takes care of the order
|
||||
});
|
||||
expect(key).toBe(2);
|
||||
expect(y).toBe(1); // takes care of the order
|
||||
|
||||
key = 1;
|
||||
|
||||
@@ -32,8 +32,8 @@ var _$ = {
|
||||
} = _$,
|
||||
rest = babelHelpers.objectWithoutProperties(_$, [_ref2, _ref3].map(babelHelpers.toPropertyKey));
|
||||
|
||||
assert.equal(y, 2);
|
||||
assert.equal(z, 3); // pure, computed property should remain as-is
|
||||
expect(y).toBe(2);
|
||||
expect(z).toBe(3); // pure, computed property should remain as-is
|
||||
|
||||
key = 2;
|
||||
var _$z = {
|
||||
@@ -46,6 +46,6 @@ var _$z = {
|
||||
} = _$z);
|
||||
x = babelHelpers.objectWithoutProperties(_$z, [key, "z"].map(babelHelpers.toPropertyKey));
|
||||
_$z;
|
||||
assert.equal(y, "two");
|
||||
assert.deepEqual(x, {});
|
||||
assert.equal(z, "zee");
|
||||
expect(y).toBe("two");
|
||||
expect(x).toEqual({});
|
||||
expect(z).toBe("zee");
|
||||
|
||||
@@ -18,4 +18,4 @@ var obj = {
|
||||
|
||||
var { a: { ...bar }, b: { ...baz }, ...foo } = obj;
|
||||
|
||||
assert.strictEqual(result, "barbazfoo");
|
||||
expect(result).toBe("barbazfoo");
|
||||
|
||||
@@ -8,8 +8,8 @@ const {
|
||||
...rest
|
||||
} = a;
|
||||
|
||||
assert.deepEqual(rest, {"foo": "bar"});
|
||||
assert.equal(omit, "three");
|
||||
expect(rest).toEqual({"foo": "bar"});
|
||||
expect(omit).toBe("three");
|
||||
|
||||
const [k1, k2, k3, k4, k5] = [null, undefined, true, false, {toString() { return "warrior"; }}];
|
||||
const c = {
|
||||
@@ -29,12 +29,12 @@ const {
|
||||
...vrest
|
||||
} = c;
|
||||
|
||||
assert.equal(v1, "1");
|
||||
assert.equal(v2, "2");
|
||||
assert.equal(v3, "3");
|
||||
assert.equal(v4, "4");
|
||||
assert.equal(v5, "5");
|
||||
assert.deepEqual(vrest, {});
|
||||
expect(v1).toBe("1");
|
||||
expect(v2).toBe("2");
|
||||
expect(v3).toBe("3");
|
||||
expect(v4).toBe("4");
|
||||
expect(v5).toBe("5");
|
||||
expect(vrest).toEqual({});
|
||||
|
||||
// shouldn't convert symbols to strings
|
||||
const sx = Symbol();
|
||||
@@ -50,5 +50,5 @@ const {
|
||||
[sy]: dy
|
||||
} = d;
|
||||
|
||||
assert.equal(dx, "sx");
|
||||
assert.equal(dy, "sy");
|
||||
expect(dx).toBe("sx");
|
||||
expect(dy).toBe("sy");
|
||||
|
||||
@@ -8,8 +8,8 @@ const {
|
||||
...rest
|
||||
} = a;
|
||||
|
||||
assert.deepEqual(rest, {"foo": "bar"});
|
||||
assert.equal(omit, "three");
|
||||
expect(rest).toEqual({"foo": "bar"});
|
||||
expect(omit).toBe("three");
|
||||
|
||||
const [k1, k2, k3, k4, k5] = [null, undefined, true, false, {toString() { return "warrior"; }}];
|
||||
const c = {
|
||||
@@ -29,12 +29,12 @@ const {
|
||||
...vrest
|
||||
} = c;
|
||||
|
||||
assert.equal(v1, "1");
|
||||
assert.equal(v2, "2");
|
||||
assert.equal(v3, "3");
|
||||
assert.equal(v4, "4");
|
||||
assert.equal(v5, "5");
|
||||
assert.deepEqual(vrest, {});
|
||||
expect(v1).toBe("1");
|
||||
expect(v2).toBe("2");
|
||||
expect(v3).toBe("3");
|
||||
expect(v4).toBe("4");
|
||||
expect(v5).toBe("5");
|
||||
expect(vrest).toEqual({});
|
||||
|
||||
// shouldn't convert symbols to strings
|
||||
const sx = Symbol();
|
||||
@@ -50,5 +50,5 @@ const {
|
||||
[sy]: dy
|
||||
} = d;
|
||||
|
||||
assert.equal(dx, "sx");
|
||||
assert.equal(dy, "sy");
|
||||
expect(dx).toBe("sx");
|
||||
expect(dy).toBe("sy");
|
||||
|
||||
@@ -6,10 +6,10 @@ const {
|
||||
[3]: omit
|
||||
} = a,
|
||||
rest = babelHelpers.objectWithoutProperties(a, ["3"]);
|
||||
assert.deepEqual(rest, {
|
||||
expect(rest).toEqual({
|
||||
"foo": "bar"
|
||||
});
|
||||
assert.equal(omit, "three");
|
||||
expect(omit).toBe("three");
|
||||
const [k1, k2, k3, k4, k5] = [null, undefined, true, false, {
|
||||
toString() {
|
||||
return "warrior";
|
||||
@@ -31,12 +31,12 @@ const {
|
||||
[k5]: v5
|
||||
} = c,
|
||||
vrest = babelHelpers.objectWithoutProperties(c, [k1, k2, k3, k4, k5].map(babelHelpers.toPropertyKey));
|
||||
assert.equal(v1, "1");
|
||||
assert.equal(v2, "2");
|
||||
assert.equal(v3, "3");
|
||||
assert.equal(v4, "4");
|
||||
assert.equal(v5, "5");
|
||||
assert.deepEqual(vrest, {}); // shouldn't convert symbols to strings
|
||||
expect(v1).toBe("1");
|
||||
expect(v2).toBe("2");
|
||||
expect(v3).toBe("3");
|
||||
expect(v4).toBe("4");
|
||||
expect(v5).toBe("5");
|
||||
expect(vrest).toEqual({}); // shouldn't convert symbols to strings
|
||||
|
||||
const sx = Symbol();
|
||||
const sy = Symbol();
|
||||
@@ -48,5 +48,5 @@ const {
|
||||
[sx]: dx,
|
||||
[sy]: dy
|
||||
} = d;
|
||||
assert.equal(dx, "sx");
|
||||
assert.equal(dy, "sy");
|
||||
expect(dx).toBe("sx");
|
||||
expect(dy).toBe("sy");
|
||||
|
||||
@@ -8,13 +8,13 @@ Object.defineProperty(src, sym2, { value: "not enumerable" });
|
||||
|
||||
const {...rest} = src;
|
||||
|
||||
assert.strictEqual(rest[sym], "symbol");
|
||||
assert.strictEqual(rest.a, "string");
|
||||
assert.deepEqual(Object.getOwnPropertyNames(rest), ["a"]);
|
||||
assert.deepEqual(Object.getOwnPropertySymbols(rest), [sym]);
|
||||
expect(rest[sym]).toBe("symbol");
|
||||
expect(rest.a).toBe("string");
|
||||
expect(Object.getOwnPropertyNames(rest)).toEqual(["a"]);
|
||||
expect(Object.getOwnPropertySymbols(rest)).toEqual([sym]);
|
||||
|
||||
const { [sym]: dst, ...noSym } = src;
|
||||
|
||||
assert.strictEqual(dst, "symbol");
|
||||
assert.strictEqual(noSym.a, "string");
|
||||
assert.deepEqual(Object.getOwnPropertySymbols(noSym), []);
|
||||
expect(dst).toBe("symbol");
|
||||
expect(noSym.a).toBe("string");
|
||||
expect(Object.getOwnPropertySymbols(noSym)).toEqual([]);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// var { x, y, ...z } = { x: 1, y: 2, a: 3, b: 4 };
|
||||
|
||||
// assert.equal(x, 1);
|
||||
// assert.equal(y, 2);
|
||||
// assert.deepEqual(z, { a: 3, b: 4 });
|
||||
// expect(x).toBe(1);
|
||||
// expect(y).toBe(2);
|
||||
// expect(z).toEqual({ a: 3, b: 4 });
|
||||
|
||||
// var complex = {
|
||||
// x: { a: 1, b: 2, c: 3 },
|
||||
@@ -12,11 +12,11 @@
|
||||
// x: { a: xa, ...xbc }
|
||||
// } = complex;
|
||||
|
||||
// assert.equal(xa, 1);
|
||||
// assert.deepEqual(xbc, { b: 2, c: 3});
|
||||
// expect(xa).toBe(1);
|
||||
// expect(xbc).toEqual({ b: 2, c: 3});
|
||||
|
||||
// // own properties
|
||||
// function ownX({ ...properties }) {
|
||||
// return properties.x;
|
||||
// }
|
||||
// assert.equal(ownX(Object.create({ x: 1 })), undefined);
|
||||
// expect(ownX(Object.create({ x: 1 }))).toBeUndefined();
|
||||
|
||||
@@ -20,21 +20,21 @@ const obj2 = { NOSET: 123, NOWRITE: 456 };
|
||||
// (spread defines them)
|
||||
const obj2Spread = { ...obj2 };
|
||||
|
||||
assert.deepEqual(obj, objSpread);
|
||||
assert.deepEqual(obj2, obj2Spread);
|
||||
expect(objSpread).toEqual(obj);
|
||||
expect(obj2Spread).toEqual(obj2);
|
||||
|
||||
const KEY = Symbol('key');
|
||||
const obj3Spread = { ...{ get foo () { return 'bar' } }, [KEY]: 'symbol' };
|
||||
assert.equal(Object.getOwnPropertyDescriptor(obj3Spread, 'foo').value, 'bar');
|
||||
assert.equal(Object.getOwnPropertyDescriptor(obj3Spread, KEY).value, 'symbol');
|
||||
expect(Object.getOwnPropertyDescriptor(obj3Spread, 'foo').value).toBe('bar');
|
||||
expect(Object.getOwnPropertyDescriptor(obj3Spread, KEY).value).toBe('symbol');
|
||||
|
||||
const obj4Spread = { ...Object.prototype };
|
||||
assert.isUndefined(Object.getOwnPropertyDescriptor(obj4Spread, 'hasOwnProperty'));
|
||||
expect(Object.getOwnPropertyDescriptor(obj4Spread, 'hasOwnProperty')).toBeUndefined();
|
||||
|
||||
assert.doesNotThrow(() => ({ ...null, ...undefined }));
|
||||
expect(() => ({ ...null, ...undefined })).not.toThrow();
|
||||
|
||||
const o = Object.create(null);
|
||||
o.a = 'foo';
|
||||
o.__proto__ = [];
|
||||
const o2 = { ...o };
|
||||
assert.equal(false, Array.isArray(Object.getPrototypeOf(o2)));
|
||||
expect(Array.isArray(Object.getPrototypeOf(o2))).toBe(false);
|
||||
|
||||
@@ -11,18 +11,18 @@ const obj = {
|
||||
};
|
||||
|
||||
const a = obj?.a;
|
||||
assert.equal(a, obj.a);
|
||||
expect(a).toBe(obj.a);
|
||||
|
||||
const b = obj?.a?.b;
|
||||
assert.equal(b, obj.a.b);
|
||||
expect(b).toBe(obj.a.b);
|
||||
|
||||
const bad = obj?.b?.b;
|
||||
assert.equal(bad, undefined);
|
||||
expect(bad).toBeUndefined();
|
||||
|
||||
let val;
|
||||
val = obj?.a?.b;
|
||||
assert.equal(val, obj.a.b);
|
||||
expect(val).toBe(obj.a.b);
|
||||
|
||||
assert.throws(() => {
|
||||
expect(() => {
|
||||
const bad = obj?.b.b;
|
||||
});
|
||||
}).toThrow();
|
||||
|
||||
@@ -7,16 +7,16 @@ const obj = {
|
||||
};
|
||||
|
||||
let test = delete obj?.a?.b;
|
||||
assert.equal(obj.a.b, undefined);
|
||||
assert.equal(test, true);
|
||||
expect(obj.a.b).toBeUndefined();
|
||||
expect(test).toBe(true);
|
||||
|
||||
test = delete obj?.a.b;
|
||||
assert.equal(obj.a.b, undefined);
|
||||
assert.equal(test, true);
|
||||
expect(obj.a.b).toBeUndefined();
|
||||
expect(test).toBe(true);
|
||||
|
||||
test = delete obj?.b?.b;
|
||||
assert.equal(obj.b, undefined);
|
||||
assert.equal(test, undefined);
|
||||
expect(obj.b).toBeUndefined();
|
||||
expect(test).toBeUndefined();
|
||||
|
||||
delete obj?.a;
|
||||
assert.equal(obj.a, undefined);
|
||||
expect(obj.a).toBeUndefined();
|
||||
|
||||
@@ -7,13 +7,13 @@ const obj = {
|
||||
};
|
||||
|
||||
let test = +obj?.a?.b;
|
||||
assert.equal(test, 0);
|
||||
expect(test).toBe(0);
|
||||
|
||||
test = +obj?.a.b;
|
||||
assert.equal(test, 0);
|
||||
expect(test).toBe(0);
|
||||
|
||||
test = +obj?.b?.b;
|
||||
assert.isNaN(test);
|
||||
expect(test).toBe(NaN);
|
||||
|
||||
test = +obj?.b?.b;
|
||||
assert.isNaN(test);
|
||||
expect(test).toBe(NaN);
|
||||
|
||||
@@ -3,7 +3,7 @@ var result = [5,10]
|
||||
|> _ => _.reduce( (a,b) => a + b )
|
||||
|> sum => sum + 1
|
||||
|
||||
assert.equal(result, 31)
|
||||
expect(result).toBe(31);
|
||||
|
||||
|
||||
var inc = (x) => x + 1;
|
||||
@@ -11,4 +11,4 @@ var double = (x) => x * 2;
|
||||
|
||||
var result2 = [4, 9].map( x => x |> inc |> double )
|
||||
|
||||
assert.deepEqual(result2, [10, 20])
|
||||
expect(result2).toEqual([10, 20]);
|
||||
|
||||
@@ -3,7 +3,7 @@ var result = [5,10]
|
||||
|> _ => _.reduce( (a,b) => a + b )
|
||||
|> sum => sum + 1
|
||||
|
||||
assert.equal(result, 31)
|
||||
expect(result).toBe(31);
|
||||
|
||||
|
||||
var inc = (x) => x + 1;
|
||||
@@ -11,4 +11,4 @@ var double = (x) => x * 2;
|
||||
|
||||
var result2 = [4, 9].map( x => x |> inc |> double )
|
||||
|
||||
assert.deepEqual(result2, [10, 20])
|
||||
expect(result2).toEqual([10, 20]);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
var _ref, _ref2, _sum;
|
||||
|
||||
var result = (_ref = [5, 10], (_ref2 = _ref.map(x => x * 2), (_sum = _ref2.reduce((a, b) => a + b), _sum + 1)));
|
||||
assert.equal(result, 31);
|
||||
expect(result).toBe(31);
|
||||
|
||||
var inc = x => x + 1;
|
||||
|
||||
@@ -12,4 +12,4 @@ var result2 = [4, 9].map(x => {
|
||||
|
||||
return _ref3 = (_x = x, inc(_x)), double(_ref3);
|
||||
});
|
||||
assert.deepEqual(result2, [10, 20]);
|
||||
expect(result2).toEqual([10, 20]);
|
||||
|
||||
@@ -9,5 +9,5 @@ var result = 1
|
||||
|> then((x) => x + 1);
|
||||
|
||||
result.then(val => {
|
||||
assert.equal(val, 3);
|
||||
expect(val).toBe(3);
|
||||
});
|
||||
|
||||
@@ -9,5 +9,5 @@ var result = 1
|
||||
|> then((x) => x + 1);
|
||||
|
||||
result.then(val => {
|
||||
assert.equal(val, 3);
|
||||
expect(val).toBe(3);
|
||||
});
|
||||
|
||||
@@ -8,5 +8,5 @@ function then(fn) {
|
||||
|
||||
var result = (_ref = (_ = 1, (async x => (await x) + 1)(_)), then(x => x + 1)(_ref));
|
||||
result.then(val => {
|
||||
assert.equal(val, 3);
|
||||
expect(val).toBe(3);
|
||||
});
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
var inc = (x) => x + 1
|
||||
|
||||
assert.equal(10 |> inc, 11);
|
||||
expect(10 |> inc).toBe(11);
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
var inc = (x) => x + 1
|
||||
|
||||
assert.equal(10 |> inc, 11);
|
||||
expect(10 |> inc).toBe(11);
|
||||
|
||||
@@ -2,4 +2,4 @@ var _;
|
||||
|
||||
var inc = x => x + 1;
|
||||
|
||||
assert.equal((_ = 10, inc(_)), 11);
|
||||
expect((_ = 10, inc(_))).toBe(11);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
var inc = (x) => x + 1;
|
||||
var double = (x) => x * 2;
|
||||
|
||||
assert.equal(10 |> inc |> double, 22);
|
||||
expect(10 |> inc |> double).toBe(22);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user