Skip to content

Commit

Permalink
add spyComponents
Browse files Browse the repository at this point in the history
  • Loading branch information
menduz committed Sep 9, 2022
1 parent 31c8413 commit 40ebfa8
Show file tree
Hide file tree
Showing 5 changed files with 174 additions and 100 deletions.
10 changes: 10 additions & 0 deletions etc/test-helpers.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
```ts

/// <reference types="jest" />

import { IConfigComponent } from '@well-known-components/interfaces';
import { IFetchComponent } from '@well-known-components/http-server';
import { Lifecycle } from '@well-known-components/interfaces';
Expand All @@ -24,12 +26,20 @@ export const defaultServerConfig: () => {
HTTP_SERVER_PORT: string;
};

// @public @deprecated (undocumented)
export type SpiedInstance<TType extends {}> = {
[P in keyof TType]: Required<TType>[P] extends (...args: any[]) => any ? jest.SpyInstance<ReturnType<Required<TType>[P]>, jest.ArgsType<Required<TType>[P]>> : never;
};

// @public
export type TestArguments<TestComponents extends Record<string, any>> = {
components: Readonly<TestComponents>;
stubComponents: {
readonly [T in keyof TestComponents]: sinon_2.SinonStubbedInstance<TestComponents[T]>;
};
spyComponents: {
readonly [T in keyof TestComponents]: SpiedInstance<TestComponents[T]>;
};
beforeStart(fn: BeforeStartFunction<TestComponents>): void;
};

Expand Down
Loading

0 comments on commit 40ebfa8

Please sign in to comment.