Skip to content

Commit

Permalink
tests(config-type): use extractSummary
Browse files Browse the repository at this point in the history
  • Loading branch information
hemal7735 authored and evenstensberg committed Feb 5, 2019
1 parent 3e30a57 commit ed36260
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 23 deletions.
16 changes: 9 additions & 7 deletions test/binCases/config-type/array/array.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"usr strict";

const { run } = require("../../../testUtils");
const { run, extractSummary } = require("../../../testUtils");

test("array", () => {
const { code, stdout, stderr } = run(__dirname, [
Expand All @@ -12,12 +12,14 @@ test("array", () => {
"production"
]);

const summary = extractSummary(stdout);

expect(code).toBe(0);
expect(stdout).toEqual(expect.anything());
expect(stdout).toContain("Child");
expect(stdout).toContain("entry-a.bundle.js");
expect(stdout).toContain("Child");
expect(stdout).toContain("entry-b.bundle.js");
expect(summary).toEqual(expect.anything());
expect(summary).toContain("Child");
expect(summary).toContain("entry-a.bundle.js");
expect(summary).toContain("Child");
expect(summary).toContain("entry-b.bundle.js");
expect(stderr).toHaveLength(0);
expect(stdout).toMatchSnapshot();
expect(summary).toMatchSnapshot();
});
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

const { run } = require("../../../testUtils");
const { run, extractSummary } = require("../../../testUtils");

test("function-promise", () => {
const { code, stdout, stderr } = run(__dirname, [
Expand All @@ -12,9 +12,11 @@ test("function-promise", () => {
"production"
]);

const summary = extractSummary(stdout);

expect(code).toBe(0);
expect(stdout).toEqual(expect.anything());
expect(stdout).toContain("entry.bundle.js");
expect(summary).toEqual(expect.anything());
expect(summary).toContain("entry.bundle.js");
expect(stderr).toHaveLength(0);
expect(stdout).toMatchSnapshot();
expect(summary).toMatchSnapshot();
});
10 changes: 6 additions & 4 deletions test/binCases/config-type/function/function.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

const { run } = require("../../../testUtils");
const { run, extractSummary } = require("../../../testUtils");

test("function", () => {
const { code, stdout, stderr } = run(__dirname, [
Expand All @@ -12,9 +12,11 @@ test("function", () => {
"production"
]);

const summary = extractSummary(stdout);

expect(code).toBe(0);
expect(stdout).toEqual(expect.anything());
expect(stdout).toContain("entry.bundle.js");
expect(summary).toEqual(expect.anything());
expect(summary).toContain("entry.bundle.js");
expect(stderr).toHaveLength(0);
expect(stdout).toMatchSnapshot();
expect(summary).toMatchSnapshot();
});
10 changes: 6 additions & 4 deletions test/binCases/config-type/object/object.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

const { run } = require("../../../testUtils");
const { run, extractSummary } = require("../../../testUtils");

test("object", () => {
const { code, stdout, stderr } = run(__dirname, [
Expand All @@ -12,9 +12,11 @@ test("object", () => {
"production"
]);

const summary = extractSummary(stdout);

expect(code).toBe(0);
expect(stdout).toEqual(expect.anything());
expect(stdout).toContain("entry.bundle.js");
expect(summary).toEqual(expect.anything());
expect(summary).toContain("entry.bundle.js");
expect(stderr).toHaveLength(0);
expect(stdout).toMatchSnapshot();
expect(summary).toMatchSnapshot();
});
10 changes: 6 additions & 4 deletions test/binCases/config-type/promise/promise.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

const { run } = require("../../../testUtils");
const { run, extractSummary } = require("../../../testUtils");

test("promise", () => {
const { code, stdout, stderr } = run(__dirname, [
Expand All @@ -12,9 +12,11 @@ test("promise", () => {
"production"
]);

const summary = extractSummary(stdout);

expect(code).toBe(0);
expect(stdout).toEqual(expect.anything());
expect(stdout).toContain("entry.bundle.js");
expect(summary).toEqual(expect.anything());
expect(summary).toContain("entry.bundle.js");
expect(stderr).toHaveLength(0);
expect(stdout).toMatchSnapshot();
expect(summary).toMatchSnapshot();
});

0 comments on commit ed36260

Please sign in to comment.