Skip to content

Commit a5441d0

Browse files
committed
tests
1 parent 22f8808 commit a5441d0

5 files changed

+457
-79
lines changed

src/OnchainKitProvider.test.tsx

+37-27
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import { useConfig } from 'wagmi';
88
import { mock } from 'wagmi/connectors';
99
import { setOnchainKitConfig } from './OnchainKitConfig';
1010
import { OnchainKitProvider } from './OnchainKitProvider';
11-
import { COINBASE_VERIFIED_ACCOUNT_SCHEMA_ID } from './identity/constants';
1211
import type { EASSchemaUid } from './identity/types';
1312
import { useOnchainKit } from './useOnchainKit';
1413
import { useProviderDependencies } from './useProviderDependencies';
@@ -184,6 +183,11 @@ describe('OnchainKitProvider', () => {
184183
theme: 'default',
185184
},
186185
paymaster: paymasterUrl,
186+
wallet: {
187+
display: 'classic',
188+
termsUrl: undefined,
189+
privacyUrl: undefined,
190+
},
187191
},
188192
chain: base,
189193
rpcUrl: null,
@@ -214,22 +218,32 @@ describe('OnchainKitProvider', () => {
214218
theme: 'default',
215219
},
216220
paymaster: null,
221+
wallet: {
222+
display: 'classic',
223+
termsUrl: undefined,
224+
privacyUrl: undefined,
225+
},
217226
},
218227
}),
219228
);
220229
});
221230
});
222231

223-
it('should use default values for appearance when config is provided', async () => {
232+
it('should use custom values when override in config is provided', async () => {
224233
const customConfig = {
225-
appearance: {},
234+
appearance: {
235+
name: 'custom name',
236+
logo: 'https://example.com/logo.png',
237+
},
238+
paymaster: 'https://example.com',
226239
};
227240

228241
render(
229242
<WagmiProvider config={mockConfig}>
230243
<QueryClientProvider client={queryClient}>
231244
<OnchainKitProvider
232245
chain={base}
246+
schemaId={schemaId}
233247
apiKey={apiKey}
234248
config={customConfig}
235249
>
@@ -247,28 +261,33 @@ describe('OnchainKitProvider', () => {
247261
chain: base,
248262
config: {
249263
appearance: {
250-
logo: appLogo,
251-
name: appName,
264+
name: 'custom name',
265+
logo: 'https://example.com/logo.png',
252266
mode: 'auto',
253267
theme: 'default',
254268
},
255-
paymaster: paymasterUrl,
269+
paymaster: 'https://example.com',
270+
wallet: {
271+
display: 'classic',
272+
termsUrl: undefined,
273+
privacyUrl: undefined,
274+
},
256275
},
257276
projectId: null,
258277
rpcUrl: null,
259-
schemaId: COINBASE_VERIFIED_ACCOUNT_SCHEMA_ID,
278+
schemaId: schemaId,
260279
}),
261280
);
262281
});
263282
});
264283

265-
it('should use custom values when override in config is provided', async () => {
284+
it('should use custom wallet config when provided', async () => {
266285
const customConfig = {
267-
appearance: {
268-
name: 'custom name',
269-
logo: 'https://example.com/logo.png',
286+
wallet: {
287+
display: 'modal',
288+
termsUrl: 'https://example.com/terms',
289+
privacyUrl: 'https://example.com/privacy',
270290
},
271-
paymaster: 'https://example.com',
272291
};
273292

274293
render(
@@ -277,7 +296,6 @@ describe('OnchainKitProvider', () => {
277296
<OnchainKitProvider
278297
chain={base}
279298
schemaId={schemaId}
280-
apiKey={apiKey}
281299
config={customConfig}
282300
>
283301
<TestComponent />
@@ -289,21 +307,13 @@ describe('OnchainKitProvider', () => {
289307
await waitFor(() => {
290308
expect(setOnchainKitConfig).toHaveBeenCalledWith(
291309
expect.objectContaining({
292-
address: null,
293-
apiKey: apiKey,
294-
chain: base,
295-
config: {
296-
appearance: {
297-
name: 'custom name',
298-
logo: 'https://example.com/logo.png',
299-
mode: 'auto',
300-
theme: 'default',
310+
config: expect.objectContaining({
311+
wallet: {
312+
display: 'modal',
313+
termsUrl: 'https://example.com/terms',
314+
privacyUrl: 'https://example.com/privacy',
301315
},
302-
paymaster: 'https://example.com',
303-
},
304-
projectId: null,
305-
rpcUrl: null,
306-
schemaId: schemaId,
316+
}),
307317
}),
308318
);
309319
});

0 commit comments

Comments
 (0)