mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
feat: Generalize and extend notification channel type behaviour
This commit is contained in:
@@ -3,10 +3,7 @@ import type { ResourceIdentifier } from '../../../../src/http/representation/Res
|
||||
import type { Logger } from '../../../../src/logging/Logger';
|
||||
import { getLoggerFor } from '../../../../src/logging/LogUtil';
|
||||
import { KeyValueChannelStorage } from '../../../../src/server/notifications/KeyValueChannelStorage';
|
||||
import type {
|
||||
NotificationChannel,
|
||||
NotificationChannelJson,
|
||||
} from '../../../../src/server/notifications/NotificationChannel';
|
||||
import type { NotificationChannel } from '../../../../src/server/notifications/NotificationChannel';
|
||||
import type { KeyValueStorage } from '../../../../src/storage/keyvalue/KeyValueStorage';
|
||||
import type { ReadWriteLocker } from '../../../../src/util/locking/ReadWriteLocker';
|
||||
import resetAllMocks = jest.resetAllMocks;
|
||||
@@ -21,12 +18,6 @@ describe('A KeyValueChannelStorage', (): void => {
|
||||
const logger = getLoggerFor('mock');
|
||||
const topic = 'http://example.com/foo';
|
||||
const identifier = { path: topic };
|
||||
const json = {
|
||||
'@context': [ 'https://www.w3.org/ns/solid/notification/v1' ],
|
||||
type: 'WebSocketSubscription2021',
|
||||
topic,
|
||||
} as NotificationChannelJson;
|
||||
const features = {};
|
||||
let channel: NotificationChannel;
|
||||
let internalMap: Map<string, any>;
|
||||
let internalStorage: KeyValueStorage<string, any>;
|
||||
@@ -53,12 +44,6 @@ describe('A KeyValueChannelStorage', (): void => {
|
||||
storage = new KeyValueChannelStorage(internalStorage, locker);
|
||||
});
|
||||
|
||||
describe('#create', (): void => {
|
||||
it('creates channel based on a notification channel.', async(): Promise<void> => {
|
||||
expect(storage.create(json, features)).toEqual(channel);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#get', (): void => {
|
||||
it('returns undefined if there is no match.', async(): Promise<void> => {
|
||||
await expect(storage.get('notexists')).resolves.toBeUndefined();
|
||||
|
||||
Reference in New Issue
Block a user