|
1 |
| -import { defaultGetTheGraphClientUrl } from '../../src/thegraph'; |
| 1 | +import { getTheGraphClientUrl } from '../../src/thegraph'; |
2 | 2 |
|
3 |
| -describe('defaultGetTheGraphClientUrl', () => { |
| 3 | +describe('getTheGraphClientUrl', () => { |
| 4 | + it('should use the URL passed as option if any', () => { |
| 5 | + const url = getTheGraphClientUrl('base', { url: 'test' }); |
| 6 | + expect(url).toBe('test'); |
| 7 | + }); |
4 | 8 | it('should build the correct URL for network supported by Alchemy', () => {
|
5 |
| - const url = defaultGetTheGraphClientUrl('base'); |
| 9 | + const url = getTheGraphClientUrl('base'); |
6 | 10 | expect(url).toBe(
|
7 | 11 | 'https://subgraph.satsuma-prod.com/e2e4905ab7c8/request-network--434873/request-payments-base/api',
|
8 | 12 | );
|
9 | 13 | });
|
10 | 14 | it('should build the correct URL when using TheGraph Explorer API key', () => {
|
11 |
| - const url = defaultGetTheGraphClientUrl('base', { theGraphExplorerApiKey: 'test' }); |
| 15 | + const url = getTheGraphClientUrl('base', { theGraphExplorerApiKey: 'test' }); |
12 | 16 | expect(url).toBe(
|
13 | 17 | 'https://gateway.thegraph.com/api/test/subgraphs/id/CcTtKy6BustyyVZ5XvFD4nLnbkgMBT1vcAEJ3sAx6bRe',
|
14 | 18 | );
|
15 | 19 | });
|
16 | 20 | it('should build the correct URL for Mantle', () => {
|
17 |
| - const url = defaultGetTheGraphClientUrl('mantle'); |
| 21 | + const url = getTheGraphClientUrl('mantle'); |
18 | 22 | expect(url).toBe(
|
19 | 23 | 'https://subgraph-api.mantle.xyz/api/public/555176e7-c1f4-49f9-9180-f2f03538b039/subgraphs/requestnetwork/request-payments-mantle/v0.1.0/gn',
|
20 | 24 | );
|
21 | 25 | });
|
22 | 26 | it('should build the correct URL for Near', () => {
|
23 |
| - const urlNear = defaultGetTheGraphClientUrl('near'); |
| 27 | + const urlNear = getTheGraphClientUrl('near'); |
24 | 28 | expect(urlNear).toBe(
|
25 | 29 | 'https://api.studio.thegraph.com/query/67444/request-payments-near/version/latest',
|
26 | 30 | );
|
27 |
| - const urlNearTestnet = defaultGetTheGraphClientUrl('near-testnet'); |
| 31 | + const urlNearTestnet = getTheGraphClientUrl('near-testnet'); |
28 | 32 | expect(urlNearTestnet).toBe(
|
29 | 33 | 'https://api.studio.thegraph.com/query/67444/request-payments-near-testnet/version/latest',
|
30 | 34 | );
|
31 |
| - const urlAurora = defaultGetTheGraphClientUrl('aurora'); |
| 35 | + const urlAurora = getTheGraphClientUrl('aurora'); |
32 | 36 | expect(urlAurora).toBe(
|
33 | 37 | 'https://api.studio.thegraph.com/query/67444/request-payments-near/version/latest',
|
34 | 38 | );
|
35 |
| - const urlAuroraTestnet = defaultGetTheGraphClientUrl('aurora-testnet'); |
| 39 | + const urlAuroraTestnet = getTheGraphClientUrl('aurora-testnet'); |
36 | 40 | expect(urlAuroraTestnet).toBe(
|
37 | 41 | 'https://api.studio.thegraph.com/query/67444/request-payments-near-testnet/version/latest',
|
38 | 42 | );
|
39 | 43 | });
|
40 | 44 | it('should build the correct URL for Near with TheGraph Explorer API key', () => {
|
41 |
| - const url = defaultGetTheGraphClientUrl('near', { theGraphExplorerApiKey: 'test' }); |
| 45 | + const url = getTheGraphClientUrl('near', { theGraphExplorerApiKey: 'test' }); |
42 | 46 | expect(url).toBe(
|
43 | 47 | 'https://gateway.thegraph.com/api/test/subgraphs/id/9yEg3h46CZiv4VuSqo1erMMBx5sHxRuW5Ai2V8goSpQL',
|
44 | 48 | );
|
|
0 commit comments