@pixotope/query 0.6.0 → 0.7.0

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.
@@ -1,48 +0,0 @@
1
- export class MockPromise<TData = any> {
2
- private _data: TData;
3
- private _resolve!: (value: TData) => void;
4
- private _reject!: (reason?: any) => void;
5
- public promise: Promise<TData>;
6
-
7
- public constructor(data: TData) {
8
- this._data = data;
9
- this.promise = new Promise((resolve, reject) => {
10
- this._resolve = resolve;
11
- this._reject = reject;
12
- });
13
- }
14
-
15
- public async resolve() {
16
- this._resolve(this._data);
17
- }
18
-
19
- public async reject() {
20
- this._reject();
21
- }
22
- }
23
-
24
- export class MockUseQueryUtils<TData = any> {
25
- private _data: TData;
26
- private _mockPromise: MockPromise<TData>;
27
-
28
- public constructor(data: TData) {
29
- this._data = data;
30
- this._mockPromise = new MockPromise(data);
31
- }
32
-
33
- public getMockedQueryFn() {
34
- return this._mockPromise.promise;
35
- }
36
-
37
- public resolve() {
38
- return this._mockPromise.resolve();
39
- }
40
-
41
- public reject() {
42
- this._mockPromise.reject();
43
- }
44
-
45
- public getData() {
46
- return this._data;
47
- }
48
- }