imp: work on store, refactor, improve todoapp

This commit is contained in:
Géry Debongnie
2019-03-22 09:52:48 +01:00
parent a236ae396a
commit d48cb5aae4
9 changed files with 150 additions and 24 deletions
+13 -1
View File
@@ -4,7 +4,8 @@ import {
idGenerator,
memoize,
debounce,
findInTree
findInTree,
shallowEqual
} from "../src/utils";
describe("escape", () => {
@@ -91,3 +92,14 @@ describe("findInTree", () => {
expect(match2).toBe(null);
});
});
describe("shallowEqual", () => {
test("simple comparisons", () => {
const obj1 = {};
expect(shallowEqual(obj1, obj1)).toBe(true);
expect(shallowEqual({}, {})).toBe(true);
expect(shallowEqual({ a: 1 }, {})).toBe(false);
expect(shallowEqual({ a: 1 }, { a: 1 })).toBe(true);
expect(shallowEqual({ a: 1 }, ["a"])).toBe(false);
});
});