@luvio/adapter-test-library 0.154.9 → 0.154.11
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/test-library.js
CHANGED
|
@@ -554,40 +554,6 @@ class MockDurableStore {
|
|
|
554
554
|
}
|
|
555
555
|
}
|
|
556
556
|
|
|
557
|
-
class MockCrossEnvironmentStorage {
|
|
558
|
-
constructor() {
|
|
559
|
-
this.environments = new Map();
|
|
560
|
-
}
|
|
561
|
-
registerEnvironmentForNotifications(notification) {
|
|
562
|
-
const identifier = (Math.random() + 1).toString(36).substring(2);
|
|
563
|
-
this.environments.set(identifier, notification);
|
|
564
|
-
return Promise.resolve({
|
|
565
|
-
identifier,
|
|
566
|
-
unsubscribe: () => {
|
|
567
|
-
this.environments.delete(identifier);
|
|
568
|
-
return Promise.resolve();
|
|
569
|
-
},
|
|
570
|
-
});
|
|
571
|
-
}
|
|
572
|
-
notifyCrossEnvironments(identifier, notification) {
|
|
573
|
-
this.environments.forEach((callback, id) => {
|
|
574
|
-
if (identifier !== id) {
|
|
575
|
-
callback(notification);
|
|
576
|
-
}
|
|
577
|
-
});
|
|
578
|
-
return Promise.resolve();
|
|
579
|
-
}
|
|
580
|
-
}
|
|
581
|
-
async function createMockCrossEnvironmentNotifier(listener, storage) {
|
|
582
|
-
const { identifier, unsubscribe } = await storage.registerEnvironmentForNotifications(listener);
|
|
583
|
-
return {
|
|
584
|
-
unsubscribe,
|
|
585
|
-
notifyCrossEnvironments: (notification) => {
|
|
586
|
-
return storage.notifyCrossEnvironments(identifier, notification);
|
|
587
|
-
},
|
|
588
|
-
};
|
|
589
|
-
}
|
|
590
|
-
|
|
591
557
|
// Use this util if you want to configure multiple network mocks in your test code.
|
|
592
558
|
// If you're only mocking one, we suggest you use buildLuvioWithNetwork instead.
|
|
593
559
|
function buildLuvioInstance(mockNetworkAdapter) {
|
|
@@ -672,4 +638,4 @@ async function testDeleteAdapterCompletesRoundtrip(params) {
|
|
|
672
638
|
return result;
|
|
673
639
|
}
|
|
674
640
|
|
|
675
|
-
export { ConnectivityState, MemoryDurableStorePersistence,
|
|
641
|
+
export { ConnectivityState, MemoryDurableStorePersistence, MockDurableStore, buildErrorMockPayload, buildFetchResponse, buildLuvioInstance, buildLuvioWithNetwork, buildMockNetworkAdapter, buildSuccessMockPayload, customMatchers, flushPendingNetworkRequests, getMockFulfilledSnapshot, getMockLuvioWithFulfilledSnapshot, getMockNetworkAdapterCallCount, isImmutable, overrideMockNetworkResponses, resetMockNetworkAdapter, setMockNetworkPayloads, setNetworkConnectivity, setupCustomLuvioMatchers, stripProperties, testAdapterCompletesRoundtrip, testDeleteAdapterCompletesRoundtrip, verifyImmutable };
|
package/dist/types/main.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ export { getMockLuvioWithFulfilledSnapshot, getMockFulfilledSnapshot } from './m
|
|
|
4
4
|
export { stripProperties, customMatchers } from './utils';
|
|
5
5
|
export { setupCustomLuvioMatchers } from './jest.setup';
|
|
6
6
|
export { MockDurableStore } from './MockDurableStore';
|
|
7
|
-
export { createMockCrossEnvironmentNotifier, MockCrossEnvironmentStorage, } from './MockCrossEnvironmentNotifier';
|
|
8
7
|
export { MemoryDurableStorePersistence, DurableStorePersistence } from './durableStorePersistence';
|
|
9
8
|
export { testAdapterCompletesRoundtrip, buildLuvioWithNetwork, buildLuvioInstance, } from './adapterRoundtrip';
|
|
10
9
|
export { testDeleteAdapterCompletesRoundtrip } from './deleteAdapterRoundtrip';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@luvio/adapter-test-library",
|
|
3
|
-
"version": "0.154.
|
|
3
|
+
"version": "0.154.11",
|
|
4
4
|
"description": "Test library for luvio adapters",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"sinon": "^14.0.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@luvio/engine": "^0.154.
|
|
32
|
-
"@luvio/environments": "^0.154.
|
|
31
|
+
"@luvio/engine": "^0.154.11",
|
|
32
|
+
"@luvio/environments": "^0.154.11",
|
|
33
33
|
"@types/sinon": "^7.5.2"
|
|
34
34
|
},
|
|
35
35
|
"volta": {
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { CrossEnvironmentNotifier, EnvironmentChangeNotification } from '@luvio/environments';
|
|
2
|
-
export type NotificationEvent = (notification: EnvironmentChangeNotification) => Promise<void>;
|
|
3
|
-
type StorageCreate = {
|
|
4
|
-
identifier: string;
|
|
5
|
-
unsubscribe: () => Promise<void>;
|
|
6
|
-
};
|
|
7
|
-
export declare class MockCrossEnvironmentStorage {
|
|
8
|
-
protected environments: Map<string, NotificationEvent>;
|
|
9
|
-
registerEnvironmentForNotifications(notification: NotificationEvent): Promise<StorageCreate>;
|
|
10
|
-
notifyCrossEnvironments(identifier: string, notification: EnvironmentChangeNotification): Promise<void>;
|
|
11
|
-
}
|
|
12
|
-
export declare function createMockCrossEnvironmentNotifier(listener: (notification: EnvironmentChangeNotification) => Promise<void>, storage: MockCrossEnvironmentStorage): Promise<CrossEnvironmentNotifier>;
|
|
13
|
-
export {};
|