You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							73 lines
						
					
					
						
							2.1 KiB
						
					
					
				
			
		
		
	
	
							73 lines
						
					
					
						
							2.1 KiB
						
					
					
				| /* eslint-disable @typescript-eslint/no-explicit-any */
 | |
| import EventEmitter from "events";
 | |
| import type { ResourceError } from "../../src";
 | |
| import {
 | |
|   Unfetched,
 | |
|   type ConnectedResult,
 | |
|   type Resource,
 | |
|   type ResourceEventEmitter,
 | |
| } from "../../src";
 | |
| import type { DatasetChanges } from "@ldo/rdf-utils";
 | |
| import type { ReadSuccess } from "../../src/results/success/ReadSuccess";
 | |
| import type { UpdateSuccess } from "../../src/results/success/UpdateSuccess";
 | |
| 
 | |
| export class MockResouce
 | |
|   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(): boolean {
 | |
|     throw new Error("Method not implemented.");
 | |
|   }
 | |
|   isFetched(): boolean {
 | |
|     throw new Error("Method not implemented.");
 | |
|   }
 | |
|   isUnfetched(): boolean {
 | |
|     throw new Error("Method not implemented.");
 | |
|   }
 | |
|   isDoingInitialFetch(): boolean {
 | |
|     throw new Error("Method not implemented.");
 | |
|   }
 | |
|   isPresent(): boolean | undefined {
 | |
|     throw new Error("Method not implemented.");
 | |
|   }
 | |
|   isAbsent(): boolean | undefined {
 | |
|     throw new Error("Method not implemented.");
 | |
|   }
 | |
|   isSubscribedToNotifications(): boolean {
 | |
|     throw new Error("Method not implemented.");
 | |
|   }
 | |
|   read(): Promise<ReadSuccess<any> | ResourceError<any>> {
 | |
|     throw new Error("Method not implemented.");
 | |
|   }
 | |
|   readIfUnfetched(): Promise<ReadSuccess<any> | ResourceError<any>> {
 | |
|     throw new Error("Method not implemented.");
 | |
|   }
 | |
|   update(
 | |
|     _datasetChanges: DatasetChanges,
 | |
|   ): Promise<UpdateSuccess<any> | ResourceError<any>> {
 | |
|     throw new Error("Method not implemented.");
 | |
|   }
 | |
|   subscribeToNotifications(_callbacks?: {
 | |
|     onNotification: (message: any) => void;
 | |
|     onNotificationError: (err: Error) => void;
 | |
|   }): Promise<string> {
 | |
|     throw new Error("Method not implemented.");
 | |
|   }
 | |
|   unsubscribeFromNotifications(_subscriptionId: string): Promise<void> {
 | |
|     throw new Error("Method not implemented.");
 | |
|   }
 | |
|   unsubscribeFromAllNotifications(): Promise<void> {
 | |
|     throw new Error("Method not implemented.");
 | |
|   }
 | |
| }
 | |
| 
 |