@luvio/adapter-test-library 0.138.1 → 0.138.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.
- package/dist/es/es2018/test-library.js +552 -552
- package/dist/es/es2018/{MockDurableStore.d.ts → types/MockDurableStore.d.ts} +16 -16
- package/dist/{umd/es5 → es/es2018/types}/adapterRoundtrip.d.ts +35 -35
- package/dist/{umd/es2018 → es/es2018/types}/customMatchers.d.ts +10 -10
- package/dist/{umd/es5 → es/es2018/types}/durableStorePersistence.d.ts +13 -13
- package/dist/es/es2018/{jest.setup.d.ts → types/jest.setup.d.ts} +1 -1
- package/dist/es/es2018/{main.d.ts → types/main.d.ts} +9 -9
- package/dist/es/es2018/{mocks.d.ts → types/mocks.d.ts} +17 -17
- package/dist/es/es2018/{network.d.ts → types/network.d.ts} +38 -38
- package/dist/{umd/es5 → es/es2018/types}/utils.d.ts +37 -37
- package/dist/es/es2018/{verification.d.ts → types/verification.d.ts} +2 -2
- package/dist/umd/es2018/test-library.js +552 -552
- package/dist/umd/es2018/{MockDurableStore.d.ts → types/MockDurableStore.d.ts} +16 -16
- package/dist/{es/es2018 → umd/es2018/types}/adapterRoundtrip.d.ts +35 -35
- package/dist/umd/{es5 → es2018/types}/customMatchers.d.ts +10 -10
- package/dist/umd/es2018/{durableStorePersistence.d.ts → types/durableStorePersistence.d.ts} +13 -13
- package/dist/umd/es2018/{jest.setup.d.ts → types/jest.setup.d.ts} +1 -1
- package/dist/umd/es2018/{main.d.ts → types/main.d.ts} +9 -9
- package/dist/umd/es2018/{mocks.d.ts → types/mocks.d.ts} +17 -17
- package/dist/umd/{es5 → es2018/types}/network.d.ts +38 -38
- package/dist/umd/es2018/{utils.d.ts → types/utils.d.ts} +37 -37
- package/dist/umd/es2018/{verification.d.ts → types/verification.d.ts} +2 -2
- package/dist/umd/es5/test-library.js +707 -707
- package/dist/umd/es5/{MockDurableStore.d.ts → types/MockDurableStore.d.ts} +16 -16
- package/dist/umd/{es2018 → es5/types}/adapterRoundtrip.d.ts +35 -35
- package/dist/{es/es2018 → umd/es5/types}/customMatchers.d.ts +10 -10
- package/dist/{es/es2018 → umd/es5/types}/durableStorePersistence.d.ts +13 -13
- package/dist/umd/es5/{jest.setup.d.ts → types/jest.setup.d.ts} +1 -1
- package/dist/umd/es5/{main.d.ts → types/main.d.ts} +9 -9
- package/dist/umd/es5/{mocks.d.ts → types/mocks.d.ts} +17 -17
- package/dist/umd/{es2018 → es5/types}/network.d.ts +38 -38
- package/dist/{es/es2018 → umd/es5/types}/utils.d.ts +37 -37
- package/dist/umd/es5/{verification.d.ts → types/verification.d.ts} +2 -2
- package/package.json +4 -4
- package/rollup.config.js +3 -7
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import type { DurableStore, DurableStoreEntries, OnDurableStoreChangedListener, DurableStoreOperation } from '@luvio/environments';
|
|
2
|
-
import type { DurableStorePersistence } from './durableStorePersistence';
|
|
3
|
-
export declare class MockDurableStore implements DurableStore {
|
|
4
|
-
private writePromises;
|
|
5
|
-
listeners: Set<OnDurableStoreChangedListener>;
|
|
6
|
-
persistence: DurableStorePersistence;
|
|
7
|
-
constructor(persistence?: DurableStorePersistence);
|
|
8
|
-
getEntries<T>(entryIds: string[], segment: string): Promise<DurableStoreEntries<T> | undefined>;
|
|
9
|
-
getAllEntries<T>(segment: string): Promise<DurableStoreEntries<T> | undefined>;
|
|
10
|
-
setEntries<T>(entries: DurableStoreEntries<T>, segment: string): Promise<void>;
|
|
11
|
-
evictEntries(ids: string[], segment: string): Promise<void>;
|
|
12
|
-
registerOnChangedListener(listener: OnDurableStoreChangedListener): () => Promise<void>;
|
|
13
|
-
batchOperations<T>(operations: DurableStoreOperation<T>[]): Promise<void>;
|
|
14
|
-
private performOperation;
|
|
15
|
-
flushPendingOperations(): Promise<void>;
|
|
16
|
-
}
|
|
1
|
+
import type { DurableStore, DurableStoreEntries, OnDurableStoreChangedListener, DurableStoreOperation } from '@luvio/environments';
|
|
2
|
+
import type { DurableStorePersistence } from './durableStorePersistence';
|
|
3
|
+
export declare class MockDurableStore implements DurableStore {
|
|
4
|
+
private writePromises;
|
|
5
|
+
listeners: Set<OnDurableStoreChangedListener>;
|
|
6
|
+
persistence: DurableStorePersistence;
|
|
7
|
+
constructor(persistence?: DurableStorePersistence);
|
|
8
|
+
getEntries<T>(entryIds: string[], segment: string): Promise<DurableStoreEntries<T> | undefined>;
|
|
9
|
+
getAllEntries<T>(segment: string): Promise<DurableStoreEntries<T> | undefined>;
|
|
10
|
+
setEntries<T>(entries: DurableStoreEntries<T>, segment: string): Promise<void>;
|
|
11
|
+
evictEntries(ids: string[], segment: string): Promise<void>;
|
|
12
|
+
registerOnChangedListener(listener: OnDurableStoreChangedListener): () => Promise<void>;
|
|
13
|
+
batchOperations<T>(operations: DurableStoreOperation<T>[]): Promise<void>;
|
|
14
|
+
private performOperation;
|
|
15
|
+
flushPendingOperations(): Promise<void>;
|
|
16
|
+
}
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import type { AdapterFactory, NetworkAdapter } from '@luvio/engine';
|
|
2
|
-
import { Luvio } from '@luvio/engine';
|
|
3
|
-
import type { MockPayload } from './network';
|
|
4
|
-
export declare function buildLuvioInstance(mockNetworkAdapter: NetworkAdapter): Luvio;
|
|
5
|
-
declare type AdapterRoundtripTestParams<C, D> = AdapterNetworkRoundtripTestParams<C, D> | AdapterNetworkRoundtripWithLuvioTestParams<C, D> | AdapterCacheHitRoundtripTestParams<C, D>;
|
|
6
|
-
declare type AdapterTest<C, D> = {
|
|
7
|
-
adapterFactory: AdapterFactory<C, D>;
|
|
8
|
-
adapterConfig: C;
|
|
9
|
-
privateProperties?: string[];
|
|
10
|
-
};
|
|
11
|
-
declare type AdapterTestWithInjectedLuvio<C, D> = AdapterTest<C, D> & {
|
|
12
|
-
luvio: Luvio;
|
|
13
|
-
expectedData: D;
|
|
14
|
-
};
|
|
15
|
-
declare type NetworkConfig = {
|
|
16
|
-
request: MockPayload['networkArgs'];
|
|
17
|
-
response: any;
|
|
18
|
-
};
|
|
19
|
-
declare type AdapterNetworkRoundtripTestParams<C, D> = AdapterTest<C, D> & {
|
|
20
|
-
type: 'network';
|
|
21
|
-
network: NetworkConfig;
|
|
22
|
-
expectedData?: D;
|
|
23
|
-
};
|
|
24
|
-
declare type AdapterNetworkRoundtripWithLuvioTestParams<C, D> = AdapterTestWithInjectedLuvio<C, D> & {
|
|
25
|
-
type: 'injectedLuvioNetwork';
|
|
26
|
-
};
|
|
27
|
-
declare type AdapterCacheHitRoundtripTestParams<C, D> = AdapterTestWithInjectedLuvio<C, D> & {
|
|
28
|
-
type: 'cache';
|
|
29
|
-
};
|
|
30
|
-
export declare function testAdapterCompletesRoundtrip<C = any, D = any>(params: AdapterRoundtripTestParams<C, D>): Promise<void>;
|
|
31
|
-
export declare function buildLuvioWithNetwork(networkConfig: NetworkConfig): {
|
|
32
|
-
luvio: Luvio;
|
|
33
|
-
networkAdapter: NetworkAdapter;
|
|
34
|
-
};
|
|
35
|
-
export {};
|
|
1
|
+
import type { AdapterFactory, NetworkAdapter } from '@luvio/engine';
|
|
2
|
+
import { Luvio } from '@luvio/engine';
|
|
3
|
+
import type { MockPayload } from './network';
|
|
4
|
+
export declare function buildLuvioInstance(mockNetworkAdapter: NetworkAdapter): Luvio;
|
|
5
|
+
declare type AdapterRoundtripTestParams<C, D> = AdapterNetworkRoundtripTestParams<C, D> | AdapterNetworkRoundtripWithLuvioTestParams<C, D> | AdapterCacheHitRoundtripTestParams<C, D>;
|
|
6
|
+
declare type AdapterTest<C, D> = {
|
|
7
|
+
adapterFactory: AdapterFactory<C, D>;
|
|
8
|
+
adapterConfig: C;
|
|
9
|
+
privateProperties?: string[];
|
|
10
|
+
};
|
|
11
|
+
declare type AdapterTestWithInjectedLuvio<C, D> = AdapterTest<C, D> & {
|
|
12
|
+
luvio: Luvio;
|
|
13
|
+
expectedData: D;
|
|
14
|
+
};
|
|
15
|
+
declare type NetworkConfig = {
|
|
16
|
+
request: MockPayload['networkArgs'];
|
|
17
|
+
response: any;
|
|
18
|
+
};
|
|
19
|
+
declare type AdapterNetworkRoundtripTestParams<C, D> = AdapterTest<C, D> & {
|
|
20
|
+
type: 'network';
|
|
21
|
+
network: NetworkConfig;
|
|
22
|
+
expectedData?: D;
|
|
23
|
+
};
|
|
24
|
+
declare type AdapterNetworkRoundtripWithLuvioTestParams<C, D> = AdapterTestWithInjectedLuvio<C, D> & {
|
|
25
|
+
type: 'injectedLuvioNetwork';
|
|
26
|
+
};
|
|
27
|
+
declare type AdapterCacheHitRoundtripTestParams<C, D> = AdapterTestWithInjectedLuvio<C, D> & {
|
|
28
|
+
type: 'cache';
|
|
29
|
+
};
|
|
30
|
+
export declare function testAdapterCompletesRoundtrip<C = any, D = any>(params: AdapterRoundtripTestParams<C, D>): Promise<void>;
|
|
31
|
+
export declare function buildLuvioWithNetwork(networkConfig: NetworkConfig): {
|
|
32
|
+
luvio: Luvio;
|
|
33
|
+
networkAdapter: NetworkAdapter;
|
|
34
|
+
};
|
|
35
|
+
export {};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { FetchResponse } from '@luvio/engine';
|
|
2
|
-
export interface LuvioCustomMatchers<R> {
|
|
3
|
-
toEqualFulfilledSnapshotWithData: (expected: any, privateProperties?: string[]) => R;
|
|
4
|
-
toEqualStaleSnapshotWithData: (expected: any, privateProperties?: string[]) => R;
|
|
5
|
-
toEqualErrorSnapshot: (expectedStatus?: number) => R;
|
|
6
|
-
toEqualOfflineErrorSnapshot: () => R;
|
|
7
|
-
toHaveBeenHitTimes: (expected: Number) => R;
|
|
8
|
-
toHaveBeenHitOnce: () => R;
|
|
9
|
-
toEqualFetchResponse: (expected: FetchResponse<unknown>) => R;
|
|
10
|
-
}
|
|
1
|
+
import type { FetchResponse } from '@luvio/engine';
|
|
2
|
+
export interface LuvioCustomMatchers<R> {
|
|
3
|
+
toEqualFulfilledSnapshotWithData: (expected: any, privateProperties?: string[]) => R;
|
|
4
|
+
toEqualStaleSnapshotWithData: (expected: any, privateProperties?: string[]) => R;
|
|
5
|
+
toEqualErrorSnapshot: (expectedStatus?: number) => R;
|
|
6
|
+
toEqualOfflineErrorSnapshot: () => R;
|
|
7
|
+
toHaveBeenHitTimes: (expected: Number) => R;
|
|
8
|
+
toHaveBeenHitOnce: () => R;
|
|
9
|
+
toEqualFetchResponse: (expected: FetchResponse<unknown>) => R;
|
|
10
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export interface DurableStorePersistence {
|
|
2
|
-
get<T>(key: string): Promise<T | undefined>;
|
|
3
|
-
set<T>(key: string, value: T): Promise<void>;
|
|
4
|
-
delete(key: string): Promise<void>;
|
|
5
|
-
flushPendingWork(): Promise<void>;
|
|
6
|
-
}
|
|
7
|
-
export declare class MemoryDurableStorePersistence implements DurableStorePersistence {
|
|
8
|
-
private store;
|
|
9
|
-
get<T>(key: string): Promise<T | undefined>;
|
|
10
|
-
set<T>(key: string, value: T): Promise<void>;
|
|
11
|
-
delete(key: string): Promise<void>;
|
|
12
|
-
flushPendingWork(): Promise<void>;
|
|
13
|
-
}
|
|
1
|
+
export interface DurableStorePersistence {
|
|
2
|
+
get<T>(key: string): Promise<T | undefined>;
|
|
3
|
+
set<T>(key: string, value: T): Promise<void>;
|
|
4
|
+
delete(key: string): Promise<void>;
|
|
5
|
+
flushPendingWork(): Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
export declare class MemoryDurableStorePersistence implements DurableStorePersistence {
|
|
8
|
+
private store;
|
|
9
|
+
get<T>(key: string): Promise<T | undefined>;
|
|
10
|
+
set<T>(key: string, value: T): Promise<void>;
|
|
11
|
+
delete(key: string): Promise<void>;
|
|
12
|
+
flushPendingWork(): Promise<void>;
|
|
13
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function setupCustomLuvioMatchers(): void;
|
|
1
|
+
export declare function setupCustomLuvioMatchers(): void;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { MockPayload, ConnectivityState, buildMockNetworkAdapter, resetMockNetworkAdapter, getMockNetworkAdapterCallCount, buildSuccessMockPayload, buildErrorMockPayload, setMockNetworkPayloads, setNetworkConnectivity, buildFetchResponse, overrideMockNetworkResponses, flushPendingNetworkRequests, } from './network';
|
|
2
|
-
export { verifyImmutable, isImmutable } from './verification';
|
|
3
|
-
export { getMockLuvioWithFulfilledSnapshot, getMockFulfilledSnapshot } from './mocks';
|
|
4
|
-
export { stripProperties, customMatchers } from './utils';
|
|
5
|
-
export { setupCustomLuvioMatchers } from './jest.setup';
|
|
6
|
-
export { MockDurableStore } from './MockDurableStore';
|
|
7
|
-
export { MemoryDurableStorePersistence, DurableStorePersistence } from './durableStorePersistence';
|
|
8
|
-
export { testAdapterCompletesRoundtrip, buildLuvioWithNetwork, buildLuvioInstance, } from './adapterRoundtrip';
|
|
9
|
-
export { LuvioCustomMatchers } from './customMatchers';
|
|
1
|
+
export { MockPayload, ConnectivityState, buildMockNetworkAdapter, resetMockNetworkAdapter, getMockNetworkAdapterCallCount, buildSuccessMockPayload, buildErrorMockPayload, setMockNetworkPayloads, setNetworkConnectivity, buildFetchResponse, overrideMockNetworkResponses, flushPendingNetworkRequests, } from './network';
|
|
2
|
+
export { verifyImmutable, isImmutable } from './verification';
|
|
3
|
+
export { getMockLuvioWithFulfilledSnapshot, getMockFulfilledSnapshot } from './mocks';
|
|
4
|
+
export { stripProperties, customMatchers } from './utils';
|
|
5
|
+
export { setupCustomLuvioMatchers } from './jest.setup';
|
|
6
|
+
export { MockDurableStore } from './MockDurableStore';
|
|
7
|
+
export { MemoryDurableStorePersistence, DurableStorePersistence } from './durableStorePersistence';
|
|
8
|
+
export { testAdapterCompletesRoundtrip, buildLuvioWithNetwork, buildLuvioInstance, } from './adapterRoundtrip';
|
|
9
|
+
export { LuvioCustomMatchers } from './customMatchers';
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
export declare function getMockLuvioWithFulfilledSnapshot(): {
|
|
2
|
-
storeLookup(): {
|
|
3
|
-
state: string;
|
|
4
|
-
};
|
|
5
|
-
snapshotAvailable(): boolean;
|
|
6
|
-
dispatchResourceRequest(): {
|
|
7
|
-
then(): {
|
|
8
|
-
state: string;
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
applyCachePolicy(): {
|
|
12
|
-
state: string;
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
export declare function getMockFulfilledSnapshot(): {
|
|
16
|
-
state: string;
|
|
17
|
-
};
|
|
1
|
+
export declare function getMockLuvioWithFulfilledSnapshot(): {
|
|
2
|
+
storeLookup(): {
|
|
3
|
+
state: string;
|
|
4
|
+
};
|
|
5
|
+
snapshotAvailable(): boolean;
|
|
6
|
+
dispatchResourceRequest(): {
|
|
7
|
+
then(): {
|
|
8
|
+
state: string;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
applyCachePolicy(): {
|
|
12
|
+
state: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export declare function getMockFulfilledSnapshot(): {
|
|
16
|
+
state: string;
|
|
17
|
+
};
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import type { NetworkAdapter, ResourceRequest, FetchResponse, Headers } from '@luvio/engine';
|
|
2
|
-
export declare enum ConnectivityState {
|
|
3
|
-
Online = 0,
|
|
4
|
-
Offline = 1
|
|
5
|
-
}
|
|
6
|
-
export interface MockPayload {
|
|
7
|
-
networkArgs: Partial<ResourceRequest>;
|
|
8
|
-
response: FetchResponse<any>;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Flushes any pending network requests. Useful for tests that need to ensure all
|
|
12
|
-
* un-awaited background refreshes are complete
|
|
13
|
-
*
|
|
14
|
-
* @param _mockNetworkAdapter {NetworkAdapter} The network adapter instance to flush
|
|
15
|
-
*/
|
|
16
|
-
export declare function flushPendingNetworkRequests(_mockNetworkAdapter: NetworkAdapter): Promise<void>;
|
|
17
|
-
export declare function buildMockNetworkAdapter(mockPayloads: MockPayload[]): NetworkAdapter;
|
|
18
|
-
export declare function setNetworkConnectivity(mockNetworkAdapter: NetworkAdapter, connectivityState: ConnectivityState): void;
|
|
19
|
-
export declare function setMockNetworkPayloads(mockNetworkAdapter: NetworkAdapter, mockPayloads: MockPayload[]): void;
|
|
20
|
-
/**
|
|
21
|
-
* Overrides the mock network adapter responses with the given "responses". Each request to
|
|
22
|
-
* the network adapter will "pop" a response from the response array. If more requests
|
|
23
|
-
* to the network adapter are made than responses in the given array then an error
|
|
24
|
-
* will be returned.
|
|
25
|
-
*
|
|
26
|
-
* This differs from setMockNetworkPayloads because it does not look at the incoming
|
|
27
|
-
* network request args to determine what the response should be, it just returns
|
|
28
|
-
* the response based on the request order.
|
|
29
|
-
*
|
|
30
|
-
* NOTE: this overrides any previously setup MockPayloads for the given network adapter
|
|
31
|
-
* until resetMockNetworkAdapter is called.
|
|
32
|
-
*/
|
|
33
|
-
export declare function overrideMockNetworkResponses(mockNetworkAdapter: NetworkAdapter, responses: FetchResponse<any>[]): void;
|
|
34
|
-
export declare function resetMockNetworkAdapter(mockNetworkAdapter: NetworkAdapter): void;
|
|
35
|
-
export declare function getMockNetworkAdapterCallCount(mockNetworkAdapter: NetworkAdapter): number | undefined;
|
|
36
|
-
export declare function buildFetchResponse<T>(body: T, status?: number, statusText?: string, headers?: Headers): FetchResponse<T>;
|
|
37
|
-
export declare function buildSuccessMockPayload(networkArgs: Partial<ResourceRequest>, body: any, headers?: Headers): MockPayload;
|
|
38
|
-
export declare function buildErrorMockPayload(networkArgs: Partial<ResourceRequest>, body: any, errorStatusCode: number, errorStatusText: string, headers?: Headers): MockPayload;
|
|
1
|
+
import type { NetworkAdapter, ResourceRequest, FetchResponse, Headers } from '@luvio/engine';
|
|
2
|
+
export declare enum ConnectivityState {
|
|
3
|
+
Online = 0,
|
|
4
|
+
Offline = 1
|
|
5
|
+
}
|
|
6
|
+
export interface MockPayload {
|
|
7
|
+
networkArgs: Partial<ResourceRequest>;
|
|
8
|
+
response: FetchResponse<any>;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Flushes any pending network requests. Useful for tests that need to ensure all
|
|
12
|
+
* un-awaited background refreshes are complete
|
|
13
|
+
*
|
|
14
|
+
* @param _mockNetworkAdapter {NetworkAdapter} The network adapter instance to flush
|
|
15
|
+
*/
|
|
16
|
+
export declare function flushPendingNetworkRequests(_mockNetworkAdapter: NetworkAdapter): Promise<void>;
|
|
17
|
+
export declare function buildMockNetworkAdapter(mockPayloads: MockPayload[]): NetworkAdapter;
|
|
18
|
+
export declare function setNetworkConnectivity(mockNetworkAdapter: NetworkAdapter, connectivityState: ConnectivityState): void;
|
|
19
|
+
export declare function setMockNetworkPayloads(mockNetworkAdapter: NetworkAdapter, mockPayloads: MockPayload[]): void;
|
|
20
|
+
/**
|
|
21
|
+
* Overrides the mock network adapter responses with the given "responses". Each request to
|
|
22
|
+
* the network adapter will "pop" a response from the response array. If more requests
|
|
23
|
+
* to the network adapter are made than responses in the given array then an error
|
|
24
|
+
* will be returned.
|
|
25
|
+
*
|
|
26
|
+
* This differs from setMockNetworkPayloads because it does not look at the incoming
|
|
27
|
+
* network request args to determine what the response should be, it just returns
|
|
28
|
+
* the response based on the request order.
|
|
29
|
+
*
|
|
30
|
+
* NOTE: this overrides any previously setup MockPayloads for the given network adapter
|
|
31
|
+
* until resetMockNetworkAdapter is called.
|
|
32
|
+
*/
|
|
33
|
+
export declare function overrideMockNetworkResponses(mockNetworkAdapter: NetworkAdapter, responses: FetchResponse<any>[]): void;
|
|
34
|
+
export declare function resetMockNetworkAdapter(mockNetworkAdapter: NetworkAdapter): void;
|
|
35
|
+
export declare function getMockNetworkAdapterCallCount(mockNetworkAdapter: NetworkAdapter): number | undefined;
|
|
36
|
+
export declare function buildFetchResponse<T>(body: T, status?: number, statusText?: string, headers?: Headers): FetchResponse<T>;
|
|
37
|
+
export declare function buildSuccessMockPayload(networkArgs: Partial<ResourceRequest>, body: any, headers?: Headers): MockPayload;
|
|
38
|
+
export declare function buildErrorMockPayload(networkArgs: Partial<ResourceRequest>, body: any, errorStatusCode: number, errorStatusText: string, headers?: Headers): MockPayload;
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import type { FetchResponse, NetworkAdapter, Snapshot } from '@luvio/engine';
|
|
2
|
-
/**
|
|
3
|
-
* Clone an object
|
|
4
|
-
*
|
|
5
|
-
* @param {object} data The object to clone
|
|
6
|
-
* @returns {object} The cloned object
|
|
7
|
-
*/
|
|
8
|
-
export declare function clone(data: any): any;
|
|
9
|
-
/**
|
|
10
|
-
* Strips the given properties from an object. Useful for comparing data payloads
|
|
11
|
-
* where the given props may not be present in the data returned from an adapter.
|
|
12
|
-
*
|
|
13
|
-
* Does not mutate the passed in object.
|
|
14
|
-
*
|
|
15
|
-
* @param {object} obj The object from which to strip properties
|
|
16
|
-
* @param {string[]} props The properties to be removed
|
|
17
|
-
* @returns {object} The updated object with the given props stripped out
|
|
18
|
-
*/
|
|
19
|
-
export declare function stripProperties(obj: {
|
|
20
|
-
[s: string]: any;
|
|
21
|
-
}, props: string[]): any;
|
|
22
|
-
export declare function doesThrow(predicate: () => void): boolean;
|
|
23
|
-
export declare function flushPromises(): Promise<unknown>;
|
|
24
|
-
declare type MatcherResult = {
|
|
25
|
-
pass: boolean;
|
|
26
|
-
message: () => string;
|
|
27
|
-
};
|
|
28
|
-
export declare const customMatchers: {
|
|
29
|
-
toEqualFulfilledSnapshotWithData: (snapshot: Snapshot<unknown, unknown>, expected: any, privateProperties?: string[] | undefined) => MatcherResult;
|
|
30
|
-
toEqualStaleSnapshotWithData: (snapshot: Snapshot<unknown, unknown>, expected: any, privateProperties?: string[] | undefined) => MatcherResult;
|
|
31
|
-
toEqualErrorSnapshot: (actual: Snapshot<unknown, unknown>, expectedStatus?: number | undefined) => MatcherResult;
|
|
32
|
-
toEqualOfflineErrorSnapshot: (actual: Snapshot<unknown, unknown>) => MatcherResult;
|
|
33
|
-
toHaveBeenHitTimes: (mockNetworkAdapter: NetworkAdapter, expected: Number) => MatcherResult;
|
|
34
|
-
toHaveBeenHitOnce: (mockNetworkAdapter: NetworkAdapter) => MatcherResult;
|
|
35
|
-
toEqualFetchResponse: (actual: FetchResponse<unknown>, expected: FetchResponse<unknown>) => MatcherResult;
|
|
36
|
-
};
|
|
37
|
-
export {};
|
|
1
|
+
import type { FetchResponse, NetworkAdapter, Snapshot } from '@luvio/engine';
|
|
2
|
+
/**
|
|
3
|
+
* Clone an object
|
|
4
|
+
*
|
|
5
|
+
* @param {object} data The object to clone
|
|
6
|
+
* @returns {object} The cloned object
|
|
7
|
+
*/
|
|
8
|
+
export declare function clone(data: any): any;
|
|
9
|
+
/**
|
|
10
|
+
* Strips the given properties from an object. Useful for comparing data payloads
|
|
11
|
+
* where the given props may not be present in the data returned from an adapter.
|
|
12
|
+
*
|
|
13
|
+
* Does not mutate the passed in object.
|
|
14
|
+
*
|
|
15
|
+
* @param {object} obj The object from which to strip properties
|
|
16
|
+
* @param {string[]} props The properties to be removed
|
|
17
|
+
* @returns {object} The updated object with the given props stripped out
|
|
18
|
+
*/
|
|
19
|
+
export declare function stripProperties(obj: {
|
|
20
|
+
[s: string]: any;
|
|
21
|
+
}, props: string[]): any;
|
|
22
|
+
export declare function doesThrow(predicate: () => void): boolean;
|
|
23
|
+
export declare function flushPromises(): Promise<unknown>;
|
|
24
|
+
declare type MatcherResult = {
|
|
25
|
+
pass: boolean;
|
|
26
|
+
message: () => string;
|
|
27
|
+
};
|
|
28
|
+
export declare const customMatchers: {
|
|
29
|
+
toEqualFulfilledSnapshotWithData: (snapshot: Snapshot<unknown, unknown>, expected: any, privateProperties?: string[] | undefined) => MatcherResult;
|
|
30
|
+
toEqualStaleSnapshotWithData: (snapshot: Snapshot<unknown, unknown>, expected: any, privateProperties?: string[] | undefined) => MatcherResult;
|
|
31
|
+
toEqualErrorSnapshot: (actual: Snapshot<unknown, unknown>, expectedStatus?: number | undefined) => MatcherResult;
|
|
32
|
+
toEqualOfflineErrorSnapshot: (actual: Snapshot<unknown, unknown>) => MatcherResult;
|
|
33
|
+
toHaveBeenHitTimes: (mockNetworkAdapter: NetworkAdapter, expected: Number) => MatcherResult;
|
|
34
|
+
toHaveBeenHitOnce: (mockNetworkAdapter: NetworkAdapter) => MatcherResult;
|
|
35
|
+
toEqualFetchResponse: (actual: FetchResponse<unknown>, expected: FetchResponse<unknown>) => MatcherResult;
|
|
36
|
+
};
|
|
37
|
+
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function isImmutable(value: any): boolean;
|
|
2
|
-
export declare function verifyImmutable(value: any, path: string): void;
|
|
1
|
+
export declare function isImmutable(value: any): boolean;
|
|
2
|
+
export declare function verifyImmutable(value: any, path: string): void;
|