/* eslint-disable @typescript-eslint/no-explicit-any */ import EventEmitter from "events"; import type { ResourceError } from "../../src.js"; import type { ResourceError } from "../../src.js"; import type { DatasetChanges } from "@ldo/rdf-utils"; import type { ReadSuccess } from "../../src/results/success/ReadSuccess.js"; import type { UpdateSuccess } from "../../src/results/success/UpdateSuccess.js"; export class MockResource extends (EventEmitter as new () => ResourceEventEmitter) implements Resource { isError = false as const; uri: string; type = "mock" as const; status: ConnectedResult; constructor(uri: string) { super(); this.uri = uri; this.status = new Unfetched(this); } isLoading = jest.fn(); isFetched = jest.fn(); isUnfetched = jest.fn(); isDoingInitialFetch = jest.fn(); isPresent = jest.fn(); isAbsent = jest.fn(); isSubscribedToNotifications = jest.fn(); read = jest.fn | ResourceError>, []>(); readIfUnfetched = jest.fn< Promise | ResourceError>, [] >(); update = jest.fn< Promise | ResourceError>, [DatasetChanges] >(); subscribeToNotifications = jest.fn< Promise, [ { onNotification: (message: any) => void; onNotificationError: (err: Error) => void; }?, ] >(); unsubscribeFromNotifications = jest.fn, [string]>(); unsubscribeFromAllNotifications = jest.fn, []>(); }