@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.
Files changed (51) hide show
  1. package/dist/{es/es2018/test-library.js → test-library.js} +10 -4
  2. package/dist/{umd/es5/types → types}/adapterRoundtrip.d.ts +1 -0
  3. package/package.json +13 -6
  4. package/babel.config.js +0 -1
  5. package/dist/es/es2018/types/adapterRoundtrip.d.ts +0 -35
  6. package/dist/umd/es2018/test-library.js +0 -600
  7. package/dist/umd/es2018/types/MockDurableStore.d.ts +0 -16
  8. package/dist/umd/es2018/types/adapterRoundtrip.d.ts +0 -35
  9. package/dist/umd/es2018/types/customMatchers.d.ts +0 -10
  10. package/dist/umd/es2018/types/durableStorePersistence.d.ts +0 -13
  11. package/dist/umd/es2018/types/jest.setup.d.ts +0 -1
  12. package/dist/umd/es2018/types/main.d.ts +0 -9
  13. package/dist/umd/es2018/types/mocks.d.ts +0 -17
  14. package/dist/umd/es2018/types/network.d.ts +0 -38
  15. package/dist/umd/es2018/types/utils.d.ts +0 -39
  16. package/dist/umd/es2018/types/verification.d.ts +0 -2
  17. package/dist/umd/es5/test-library.js +0 -818
  18. package/dist/umd/es5/types/MockDurableStore.d.ts +0 -16
  19. package/dist/umd/es5/types/customMatchers.d.ts +0 -10
  20. package/dist/umd/es5/types/durableStorePersistence.d.ts +0 -13
  21. package/dist/umd/es5/types/jest.setup.d.ts +0 -1
  22. package/dist/umd/es5/types/main.d.ts +0 -9
  23. package/dist/umd/es5/types/mocks.d.ts +0 -17
  24. package/dist/umd/es5/types/network.d.ts +0 -38
  25. package/dist/umd/es5/types/utils.d.ts +0 -39
  26. package/dist/umd/es5/types/verification.d.ts +0 -2
  27. package/jest.config.js +0 -16
  28. package/matcher-types.d.ts +0 -10
  29. package/project.json +0 -8
  30. package/rollup.config.js +0 -33
  31. package/src/MockDurableStore.ts +0 -145
  32. package/src/__tests__/MockDurableStore.spec.ts +0 -53
  33. package/src/adapterRoundtrip.ts +0 -101
  34. package/src/customMatchers.ts +0 -17
  35. package/src/durableStorePersistence.ts +0 -34
  36. package/src/jest.setup.ts +0 -4
  37. package/src/main.ts +0 -26
  38. package/src/mocks.ts +0 -31
  39. package/src/network.ts +0 -240
  40. package/src/utils.ts +0 -207
  41. package/src/verification.ts +0 -60
  42. package/tsconfig.json +0 -4
  43. /package/dist/{es/es2018/types → types}/MockDurableStore.d.ts +0 -0
  44. /package/dist/{es/es2018/types → types}/customMatchers.d.ts +0 -0
  45. /package/dist/{es/es2018/types → types}/durableStorePersistence.d.ts +0 -0
  46. /package/dist/{es/es2018/types → types}/jest.setup.d.ts +0 -0
  47. /package/dist/{es/es2018/types → types}/main.d.ts +0 -0
  48. /package/dist/{es/es2018/types → types}/mocks.d.ts +0 -0
  49. /package/dist/{es/es2018/types → types}/network.d.ts +0 -0
  50. /package/dist/{es/es2018/types → types}/utils.d.ts +0 -0
  51. /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
- expect(result.data).toBeDefined();
539
- expect(result).toEqualFulfilledSnapshotWithData(params.type === 'network'
540
- ? params.expectedData || params.network.response
541
- : params.expectedData, params.privateProperties);
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) {
@@ -7,6 +7,7 @@ type AdapterTest<C, D> = {
7
7
  adapterFactory: AdapterFactory<C, D>;
8
8
  adapterConfig: C;
9
9
  privateProperties?: string[];
10
+ isError?: boolean;
10
11
  };
11
12
  type AdapterTestWithInjectedLuvio<C, D> = AdapterTest<C, D> & {
12
13
  luvio: Luvio;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luvio/adapter-test-library",
3
- "version": "0.142.2",
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
- "main": "dist/umd/es2018/test-library.js",
12
- "module": "dist/es/es2018/test-library.js",
13
- "types": "dist/es/es2018/types/main.d.ts",
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.2",
25
- "@luvio/environments": "^0.142.2",
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 {};