Skip to content

Commit

Permalink
fix: update tests for latest jest version
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Regan <alex.joseph.regan@gmail.com>
  • Loading branch information
alexsasharegan committed Jun 1, 2019
1 parent 5ea3888 commit 1e4f2f0
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 14 deletions.
7 changes: 1 addition & 6 deletions __test__/array-merge.test.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
import { VNodeData, VNodeDirective } from "vue";
import { VNodeData } from "vue";
import { mergeData } from "../src/index";

it("should execute array merge on class, style, directive properties", () => {
function inserted(el: any) {
el.focus();
}
let vd1: VNodeData = {
class: ["a", { b: true, c: false }],
style: ["display:block;", { color: "red", fontSize: "16px" }],
};
let vd2: VNodeData = {
class: ["d", { e: true, f: false }],
style: "position:absolute;",
directives: [{ focus: { inserted } }],
};

let actual = mergeData(vd1, vd2);
Expand All @@ -23,7 +19,6 @@ it("should execute array merge on class, style, directive properties", () => {
"display:block;",
{ color: "red", fontSize: "16px" },
],
directives: [{ focus: { inserted } }],
};

// Check values recursively
Expand Down
8 changes: 6 additions & 2 deletions __test__/handler-merge.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { VNodeData, VNodeDirective } from "vue";
import { VNodeData } from "vue";
import { mergeData } from "../src/index";

it("should not mutate original object (issue #2)", () => {
Expand Down Expand Up @@ -53,7 +53,7 @@ it("should set single handlers and concat multi", () => {

it("should call the right-most argument first", () => {
let first = 0;
let factory = n => () => {
let factory = (n: number) => () => {
if (!first) {
first = n;
}
Expand All @@ -67,6 +67,10 @@ it("should call the right-most argument first", () => {
);

expect(Array.isArray(actual.on.click)).toBe(true);
if (!Array.isArray(actual.on.click)) {
throw new TypeError();
}

for (const fn of actual.on.click) {
fn();
}
Expand Down
6 changes: 3 additions & 3 deletions __test__/kitchen-sink.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { VNodeData, VNodeDirective } from "vue";
import { VNodeData } from "vue";
import { mergeData } from "../src/index";

it("should handle multiple arguments", () => {
Expand Down Expand Up @@ -28,8 +28,8 @@ it("should handle multiple arguments", () => {
});

it("should work like in the example", () => {
let onClick1 = e => alert("💥");
let onClick2 = e => alert("👍");
let onClick1 = () => alert("💥");
let onClick2 = () => alert("👍");

let componentData: VNodeData = {
staticClass: "fn-component", // concatenates all static classes
Expand Down
2 changes: 1 addition & 1 deletion __test__/nullable-objects.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { VNodeData, VNodeDirective } from "vue";
import { VNodeData } from "vue";
import { mergeData } from "../src/index";

it("should handle nested nullable objects as initial state", () => {
Expand Down
2 changes: 1 addition & 1 deletion __test__/reassign.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { VNodeData, VNodeDirective } from "vue";
import { VNodeData } from "vue";
import { mergeData } from "../src/index";

it("should reassign primitives", () => {
Expand Down
2 changes: 1 addition & 1 deletion __test__/string-concat.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { VNodeData, VNodeDirective } from "vue";
import { VNodeData } from "vue";
import { mergeData } from "../src/index";

it("should concatenate strings", () => {
Expand Down

0 comments on commit 1e4f2f0

Please # to comment.