Skip to content

Commit

Permalink
Merge 0f8a031 into 608ce60
Browse files Browse the repository at this point in the history
  • Loading branch information
jtenner committed Jun 18, 2019
2 parents 608ce60 + 0f8a031 commit 46a8ff9
Show file tree
Hide file tree
Showing 42 changed files with 47,348 additions and 55,522 deletions.
50 changes: 50 additions & 0 deletions __tests__/TestContext.log.spec.ts
@@ -0,0 +1,50 @@
import { TestContext } from "../src/test/TestContext";
import { createLogModule } from "./setup/createLogModule";

let ctx: TestContext;

let start = new Promise<void>((resolve, reject) => {
createLogModule({}, (err, result) => {
if (err) {
console.log(err);
reject(err);
} else {
ctx = result!;
resolve();
}
});
});

beforeEach(() => start);

describe("logged values", () => {
test("log values", () => {
for (const group of ctx.testGroups) {
for (const log of group.logs) {
expect(log.bytes).toMatchSnapshot(`${group.name} bytes`);
expect(log.message).toMatchSnapshot(`${group.name} message`);
expect(log.offset).toMatchSnapshot(`${group.name} offset`);
expect(log.pointer).toMatchSnapshot(`${group.name} pointer`);
expect(log.stack).toMatchSnapshot(`${group.name} stack`);
expect(log.target).toBe(group);
expect(log.value).toMatchSnapshot(`${group.name} snapshot`);
}

for (const test of group.tests) {
for (const log of test.logs) {
expect(log.bytes).toMatchSnapshot(`${group.name}~${test.name} bytes`);
expect(log.message).toMatchSnapshot(`${group.name}~${test.name} message`);
expect(log.offset).toMatchSnapshot(`${group.name}~${test.name} offset`);
expect(log.pointer).toMatchSnapshot(`${group.name}~${test.name} pointer`);
expect(log.stack).toMatchSnapshot(`${group.name}~${test.name} stack`);
expect(log.target).toBe(test);
expect(log.value).toMatchSnapshot(`${group.name}~${test.name} snapshot`);
}
}

for (const todo of group.todos) {
expect(todo).toMatchSnapshot(`${group.name} todo`);
}
}
});
});
57 changes: 57 additions & 0 deletions __tests__/TestContext.pass-fail.spec.ts
@@ -0,0 +1,57 @@
import { TestContext } from "../src/test/TestContext";
import { createPassFailModule } from "./setup/createPassFailModule";

let ctx: TestContext;

let start = new Promise<void>((resolve, reject) => {
createPassFailModule({}, (err, result) => {
if (err) {
console.log(err);
reject(err);
} else {
ctx = result!;
resolve();
}
});
});

beforeAll(() => start);

describe("pass-fail", () => {
test("pass-fail", () => {
for (const group of ctx.testGroups) {
expect(group.pass).toMatchSnapshot(`${group.name} pass`);
expect(group.afterAllPointers).toMatchSnapshot(`${group.name} afterAllPointers`);
expect(group.afterEachPointers).toMatchSnapshot(`${group.name} afterEachPointers`);
expect(group.beforeEachPointers).toMatchSnapshot(`${group.name} beforeEachPointers`);
expect(group.beforeAllPointers).toMatchSnapshot(`${group.name} beforeAllPointers`);
expect(group.reason).toMatchSnapshot(`${group.name} reason`);

for (const test of group.tests) {
expect(test.pass).toMatchSnapshot(`${group.name}~${test.name} pass`);
if (test.actual) {
expect(test.actual.bytes).toMatchSnapshot(`${group.name}~${test.name}~actual bytes`);
expect(test.actual.message).toMatchSnapshot(`${group.name}~${test.name}~actual message`);
expect(test.actual.offset).toMatchSnapshot(`${group.name}~${test.name}~actual offset`);
expect(test.actual.pointer).toMatchSnapshot(`${group.name}~${test.name}~actual pointer`);
expect(test.actual.stack).toMatchSnapshot(`${group.name}~${test.name}~actual stack`);
expect(test.actual.target).toBe(test);
expect(test.actual.value).toMatchSnapshot(`${group.name}~${test.name}~actual value`);
}
if (test.expected) {
expect(test.expected.bytes).toMatchSnapshot(`${group.name}~${test.name}~expected bytes`);
expect(test.expected.message).toMatchSnapshot(`${group.name}~${test.name}~expected message`);
expect(test.expected.offset).toMatchSnapshot(`${group.name}~${test.name}~expected offset`);
expect(test.expected.pointer).toMatchSnapshot(`${group.name}~${test.name}~expected pointer`);
expect(test.expected.stack).toMatchSnapshot(`${group.name}~${test.name}~expected stack`);
expect(test.expected.target).toBe(test);
expect(test.expected.value).toMatchSnapshot(`${group.name}~${test.name}~expected value`);
expect(test.expected.negated).toMatchSnapshot(`${group.name}~${test.name}~expected negated`);
}
expect(test.functionPointer).toMatchSnapshot(`${group.name}~${test.name} functionPointer`);
expect(test.message).toMatchSnapshot(`${group.name}~${test.name} message`);
expect(test.negated).toMatchSnapshot(`${group.name}~${test.name} negated`);
}
}
});
});
34 changes: 34 additions & 0 deletions __tests__/TestContext.performance.spec.ts
@@ -0,0 +1,34 @@
import { TestContext } from "../src/test/TestContext";
import { createPerformanceModule } from "./setup/createPerformanceModule";

let ctx: TestContext;

let start = new Promise<void>((resolve, reject) => {
createPerformanceModule({}, (err, result) => {
if (err) {
console.log(err);
reject(err);
} else {
ctx = result!;
resolve();
}
});
});

beforeAll(() => start);

describe("pass-fail", () => {
test("pass-fail", () => {
for (const group of ctx.testGroups) {
for (const test of group.tests) {
expect(test.performance).toMatchSnapshot(`${group.name}~${test.name} performance`);
expect(test.hasAverage).toMatchSnapshot(`${group.name}~${test.name} hasAverage`);
expect(test.hasMedian).toMatchSnapshot(`${group.name}~${test.name} hasMedian`);
expect(test.hasMin).toMatchSnapshot(`${group.name}~${test.name} hasMin`);
expect(test.hasMax).toMatchSnapshot(`${group.name}~${test.name} hasMax`);
expect(test.hasStdDev).toMatchSnapshot(`${group.name}~${test.name} hasStdDev`);
expect(test.hasVariance).toMatchSnapshot(`${group.name}~${test.name} hasVariance`);
}
}
});
});
File renamed without changes.

0 comments on commit 46a8ff9

Please sign in to comment.