Function
createClientWithSpy
(options: Partial<ReactNativeClientOptions>)
Source from the content-addressed store, hash-verified
| 916 | } |
| 917 | |
| 918 | function createClientWithSpy(options: Partial<ReactNativeClientOptions>) { |
| 919 | const onSpy = jest.fn(); |
| 920 | class SpyClient extends ReactNativeClient { |
| 921 | public on(hook: string, callback: unknown): () => void { |
| 922 | onSpy(hook, callback); |
| 923 | // @ts-expect-error - the public interface doesn't allow string and unknown |
| 924 | return super.on(hook, callback); |
| 925 | } |
| 926 | } |
| 927 | |
| 928 | return { |
| 929 | client: new SpyClient({ |
| 930 | ...DEFAULT_OPTIONS, |
| 931 | dsn: EXAMPLE_DSN, |
| 932 | ...options, |
| 933 | }), |
| 934 | onSpy, |
| 935 | }; |
| 936 | } |
Tested by
no test coverage detected