@luvio/adapter-test-library 0.142.2 → 0.142.4
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 → test-library.js} +10 -4
- package/dist/{umd/es5/types → types}/adapterRoundtrip.d.ts +1 -0
- package/package.json +13 -6
- package/babel.config.js +0 -1
- package/dist/es/es2018/types/adapterRoundtrip.d.ts +0 -35
- package/dist/umd/es2018/test-library.js +0 -600
- package/dist/umd/es2018/types/MockDurableStore.d.ts +0 -16
- package/dist/umd/es2018/types/adapterRoundtrip.d.ts +0 -35
- package/dist/umd/es2018/types/customMatchers.d.ts +0 -10
- package/dist/umd/es2018/types/durableStorePersistence.d.ts +0 -13
- package/dist/umd/es2018/types/jest.setup.d.ts +0 -1
- package/dist/umd/es2018/types/main.d.ts +0 -9
- package/dist/umd/es2018/types/mocks.d.ts +0 -17
- package/dist/umd/es2018/types/network.d.ts +0 -38
- package/dist/umd/es2018/types/utils.d.ts +0 -39
- package/dist/umd/es2018/types/verification.d.ts +0 -2
- package/dist/umd/es5/test-library.js +0 -818
- package/dist/umd/es5/types/MockDurableStore.d.ts +0 -16
- package/dist/umd/es5/types/customMatchers.d.ts +0 -10
- package/dist/umd/es5/types/durableStorePersistence.d.ts +0 -13
- package/dist/umd/es5/types/jest.setup.d.ts +0 -1
- package/dist/umd/es5/types/main.d.ts +0 -9
- package/dist/umd/es5/types/mocks.d.ts +0 -17
- package/dist/umd/es5/types/network.d.ts +0 -38
- package/dist/umd/es5/types/utils.d.ts +0 -39
- package/dist/umd/es5/types/verification.d.ts +0 -2
- package/jest.config.js +0 -16
- package/matcher-types.d.ts +0 -10
- package/project.json +0 -8
- package/rollup.config.js +0 -33
- package/src/MockDurableStore.ts +0 -145
- package/src/__tests__/MockDurableStore.spec.ts +0 -53
- package/src/adapterRoundtrip.ts +0 -101
- package/src/customMatchers.ts +0 -17
- package/src/durableStorePersistence.ts +0 -34
- package/src/jest.setup.ts +0 -4
- package/src/main.ts +0 -26
- package/src/mocks.ts +0 -31
- package/src/network.ts +0 -240
- package/src/utils.ts +0 -207
- package/src/verification.ts +0 -60
- package/tsconfig.json +0 -4
- /package/dist/{es/es2018/types → types}/MockDurableStore.d.ts +0 -0
- /package/dist/{es/es2018/types → types}/customMatchers.d.ts +0 -0
- /package/dist/{es/es2018/types → types}/durableStorePersistence.d.ts +0 -0
- /package/dist/{es/es2018/types → types}/jest.setup.d.ts +0 -0
- /package/dist/{es/es2018/types → types}/main.d.ts +0 -0
- /package/dist/{es/es2018/types → types}/mocks.d.ts +0 -0
- /package/dist/{es/es2018/types → types}/network.d.ts +0 -0
- /package/dist/{es/es2018/types → types}/utils.d.ts +0 -0
- /package/dist/{es/es2018/types → types}/verification.d.ts +0 -0
|
@@ -535,10 +535,16 @@ function buildLuvioInstance(mockNetworkAdapter) {
|
|
|
535
535
|
async function testAdapterCompletesRoundtrip(params) {
|
|
536
536
|
const adapterSetup = setupAdapter(params);
|
|
537
537
|
const result = await callAdapter(adapterSetup, params);
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
538
|
+
if (params.isError) {
|
|
539
|
+
expect(result.data).toBeUndefined();
|
|
540
|
+
expect(result).toEqualErrorSnapshot();
|
|
541
|
+
}
|
|
542
|
+
else {
|
|
543
|
+
expect(result.data).toBeDefined();
|
|
544
|
+
expect(result).toEqualFulfilledSnapshotWithData(params.type === 'network'
|
|
545
|
+
? params.expectedData || params.network.response
|
|
546
|
+
: params.expectedData, params.privateProperties);
|
|
547
|
+
}
|
|
542
548
|
return result;
|
|
543
549
|
}
|
|
544
550
|
function setupAdapter(params) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@luvio/adapter-test-library",
|
|
3
|
-
"version": "0.142.
|
|
3
|
+
"version": "0.142.4",
|
|
4
4
|
"description": "Test library for luvio adapters",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -8,9 +8,16 @@
|
|
|
8
8
|
"directory": "packages/@luvio/adapter-test-library"
|
|
9
9
|
},
|
|
10
10
|
"license": "MIT",
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
"exports": {
|
|
12
|
+
"types": "./dist/types/main.d.ts",
|
|
13
|
+
"import": "./dist/test-library.js",
|
|
14
|
+
"default": "./dist/test-library.js"
|
|
15
|
+
},
|
|
16
|
+
"module": "dist/test-library.js",
|
|
17
|
+
"types": "dist/types/main.d.ts",
|
|
18
|
+
"files": [
|
|
19
|
+
"dist/"
|
|
20
|
+
],
|
|
14
21
|
"scripts": {
|
|
15
22
|
"build": "rollup --bundleConfigAsCjs --config rollup.config.js",
|
|
16
23
|
"clean": "rm -rf dist",
|
|
@@ -21,8 +28,8 @@
|
|
|
21
28
|
"sinon": "^14.0.0"
|
|
22
29
|
},
|
|
23
30
|
"devDependencies": {
|
|
24
|
-
"@luvio/engine": "^0.142.
|
|
25
|
-
"@luvio/environments": "^0.142.
|
|
31
|
+
"@luvio/engine": "^0.142.4",
|
|
32
|
+
"@luvio/environments": "^0.142.4",
|
|
26
33
|
"@types/sinon": "^7.5.2"
|
|
27
34
|
},
|
|
28
35
|
"volta": {
|
package/babel.config.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require('../../../babel.config');
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { AdapterFactory, NetworkAdapter, Snapshot } from '@luvio/engine';
|
|
2
|
-
import { Luvio } from '@luvio/engine';
|
|
3
|
-
import type { MockPayload } from './network';
|
|
4
|
-
export declare function buildLuvioInstance(mockNetworkAdapter: NetworkAdapter): Luvio;
|
|
5
|
-
type AdapterRoundtripTestParams<C, D> = AdapterNetworkRoundtripTestParams<C, D> | AdapterNetworkRoundtripWithLuvioTestParams<C, D> | AdapterCacheHitRoundtripTestParams<C, D>;
|
|
6
|
-
type AdapterTest<C, D> = {
|
|
7
|
-
adapterFactory: AdapterFactory<C, D>;
|
|
8
|
-
adapterConfig: C;
|
|
9
|
-
privateProperties?: string[];
|
|
10
|
-
};
|
|
11
|
-
type AdapterTestWithInjectedLuvio<C, D> = AdapterTest<C, D> & {
|
|
12
|
-
luvio: Luvio;
|
|
13
|
-
expectedData: D;
|
|
14
|
-
};
|
|
15
|
-
type NetworkConfig = {
|
|
16
|
-
request: MockPayload['networkArgs'];
|
|
17
|
-
response: any;
|
|
18
|
-
};
|
|
19
|
-
type AdapterNetworkRoundtripTestParams<C, D> = AdapterTest<C, D> & {
|
|
20
|
-
type: 'network';
|
|
21
|
-
network: NetworkConfig;
|
|
22
|
-
expectedData?: D;
|
|
23
|
-
};
|
|
24
|
-
type AdapterNetworkRoundtripWithLuvioTestParams<C, D> = AdapterTestWithInjectedLuvio<C, D> & {
|
|
25
|
-
type: 'injectedLuvioNetwork';
|
|
26
|
-
};
|
|
27
|
-
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<Snapshot<D, unknown>>;
|
|
31
|
-
export declare function buildLuvioWithNetwork(networkConfig: NetworkConfig): {
|
|
32
|
-
luvio: Luvio;
|
|
33
|
-
networkAdapter: NetworkAdapter;
|
|
34
|
-
};
|
|
35
|
-
export {};
|