resourcerer 2.0.0-beta-1 → 2.0.0-beta-2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/test/utils.test.js +0 -47
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "resourcerer",
3
- "version": "2.0.0-beta-1",
3
+ "version": "2.0.0-beta-2",
4
4
  "repository": "github.com/noahgrant/resourcerer",
5
5
  "description": "Declarative data-fetching and caching framework for React",
6
6
  "keywords": ["declarative data-fetching framework", "react"],
@@ -1,6 +1,5 @@
1
1
  import { Utils } from "../index";
2
2
  import {
3
- camelize,
4
3
  hasErrored,
5
4
  hasLoaded,
6
5
  isDeepEqual,
@@ -21,19 +20,15 @@ describe("Utils", () => {
21
20
  it("returns true if any loading state has errored", () => {
22
21
  expect(hasErrored(["error", "loading"])).toBe(true);
23
22
  expect(hasErrored("error")).toBe(true);
24
- expect(hasErrored({ myLoadingState: "error" })).toBe(true);
25
23
  expect(Utils.hasErrored(["error", "loading"])).toBe(true);
26
24
  expect(Utils.hasErrored("error")).toBe(true);
27
- expect(Utils.hasErrored({ myLoadingState: "error" })).toBe(true);
28
25
  });
29
26
 
30
27
  it("returns false if no loading states have errored", () => {
31
28
  expect(hasErrored(["loaded", "loading"])).toBe(false);
32
29
  expect(hasErrored("loaded")).toBe(false);
33
- expect(hasErrored({ myLoadingState: "loaded" })).toBe(false);
34
30
  expect(Utils.hasErrored(["loaded", "loading"])).toBe(false);
35
31
  expect(Utils.hasErrored("loaded")).toBe(false);
36
- expect(Utils.hasErrored({ myLoadingState: "loaded" })).toBe(false);
37
32
  });
38
33
 
39
34
  it("returns false if an undefined loading state is passed", () => {
@@ -46,19 +41,15 @@ describe("Utils", () => {
46
41
  it("returns true if any loading state is loading", () => {
47
42
  expect(isLoading(["error", "loading"])).toBe(true);
48
43
  expect(isLoading("loading")).toBe(true);
49
- expect(isLoading({ myLoadingState: "loading" })).toBe(true);
50
44
  expect(Utils.isLoading(["error", "loading"])).toBe(true);
51
45
  expect(Utils.isLoading("loading")).toBe(true);
52
- expect(Utils.isLoading({ myLoadingState: "loading" })).toBe(true);
53
46
  });
54
47
 
55
48
  it("returns false if no loading states are loading", () => {
56
49
  expect(isLoading(["loaded", "loaded"])).toBe(false);
57
50
  expect(isLoading("loaded")).toBe(false);
58
- expect(isLoading({ myLoadingState: "loaded" })).toBe(false);
59
51
  expect(Utils.isLoading(["loaded", "loaded"])).toBe(false);
60
52
  expect(Utils.isLoading("loaded")).toBe(false);
61
- expect(Utils.isLoading({ myLoadingState: "loaded" })).toBe(false);
62
53
  });
63
54
 
64
55
  it("returns false if an undefined loading state is passed", () => {
@@ -71,21 +62,17 @@ describe("Utils", () => {
71
62
  it("returns true if all loading states have loaded", () => {
72
63
  expect(hasLoaded(["loaded", "loaded"])).toBe(true);
73
64
  expect(hasLoaded("loaded")).toBe(true);
74
- expect(hasLoaded({ myLoadingState: "loaded" })).toBe(true);
75
65
  expect(Utils.hasLoaded(["loaded", "loaded"])).toBe(true);
76
66
  expect(Utils.hasLoaded("loaded")).toBe(true);
77
- expect(Utils.hasLoaded({ myLoadingState: "loaded" })).toBe(true);
78
67
  });
79
68
 
80
69
  it("returns false if any state has not loaded", () => {
81
70
  expect(hasLoaded(["error", "loaded"])).toBe(false);
82
71
  expect(hasLoaded(["loaded", "loading"])).toBe(false);
83
72
  expect(hasLoaded("loading")).toBe(false);
84
- expect(hasLoaded({ myLoadingState: "loading" })).toBe(false);
85
73
  expect(Utils.hasLoaded(["error", "loaded"])).toBe(false);
86
74
  expect(Utils.hasLoaded(["loaded", "loading"])).toBe(false);
87
75
  expect(Utils.hasLoaded("loading")).toBe(false);
88
- expect(Utils.hasLoaded({ myLoadingState: "loading" })).toBe(false);
89
76
  });
90
77
 
91
78
  it("returns false if an undefined loading state is passed", () => {
@@ -98,19 +85,15 @@ describe("Utils", () => {
98
85
  it("returns true if any loading state is pending", () => {
99
86
  expect(isPending(["pending", "loading"])).toBe(true);
100
87
  expect(isPending("pending")).toBe(true);
101
- expect(isPending({ myLoadingState: "pending" })).toBe(true);
102
88
  expect(Utils.isPending(["pending", "loading"])).toBe(true);
103
89
  expect(Utils.isPending("pending")).toBe(true);
104
- expect(Utils.isPending({ myLoadingState: "pending" })).toBe(true);
105
90
  });
106
91
 
107
92
  it("returns false if no loading states are pending", () => {
108
93
  expect(isPending(["loaded", "loading"])).toBe(false);
109
94
  expect(isPending("loaded")).toBe(false);
110
- expect(isPending({ myLoadingState: "loaded" })).toBe(false);
111
95
  expect(Utils.isPending(["loaded", "loading"])).toBe(false);
112
96
  expect(Utils.isPending("loaded")).toBe(false);
113
- expect(Utils.isPending({ myLoadingState: "loaded" })).toBe(false);
114
97
  });
115
98
 
116
99
  it("returns false if an undefined loading state is passed", () => {
@@ -119,36 +102,6 @@ describe("Utils", () => {
119
102
  });
120
103
  });
121
104
 
122
- describe("camelize", () => {
123
- it("passes words that are already camelCase", () => {
124
- expect(camelize("camelCase")).toEqual("camelCase");
125
- // also leaves alone PascalCase
126
- expect(camelize("PascalCase")).toEqual("PascalCase");
127
- // defaults
128
- expect(camelize()).toEqual("");
129
- });
130
-
131
- it("passes words that are single word lowercase", () => {
132
- expect(camelize("lowercase")).toEqual("lowercase");
133
- });
134
-
135
- it("lowercases words that are all uppercase", () => {
136
- expect(camelize("UPPERCASE")).toEqual("uppercase");
137
- });
138
-
139
- it("turns snake_case words into camelcase", () => {
140
- expect(camelize("snake_case_words")).toEqual("snakeCaseWords");
141
- });
142
-
143
- it("turns spine-case words into camelcase", () => {
144
- expect(camelize("spine-case-words")).toEqual("spineCaseWords");
145
- });
146
-
147
- it("turns space-separated words into camelcase", () => {
148
- expect(camelize("space separated words")).toEqual("spaceSeparatedWords");
149
- });
150
- });
151
-
152
105
  describe("once", () => {
153
106
  it("invokes a function maximum once", () => {
154
107
  var testFn = vi.fn(),