Skip to content

Commit

Permalink
Fix unit tests
Browse files Browse the repository at this point in the history
Had to update the new aggregator paths
and update the number of checks for the
checkRedirects in fetchResource.
That was a remnant from the deriveDynamicField
PR.
  • Loading branch information
Tzal3x authored and giac-mysten committed Oct 16, 2024
1 parent 14d5e8d commit b16f441
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions portal/common/lib/redirects.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ describe('redirectToPortalURLResponse', () => {
});

const redirectToAggregatorUrlTestCases: [string, string, string][] = [
['https://example.com', '12345', 'https://aggregator-devnet.walrus.space/v1/12345'],
['https://walrus.site', 'blob-id', 'https://aggregator-devnet.walrus.space/v1/blob-id'],
['http://localhost:8080', 'abcde', 'https://aggregator-devnet.walrus.space/v1/abcde'],
['https://example.com', '12345', 'https://aggregator.walrus-testnet.walrus.space/v1/12345'],
['https://walrus.site', 'blob-id', 'https://aggregator.walrus-testnet.walrus.space/v1/blob-id'],
['http://localhost:8080', 'abcde', 'https://aggregator.walrus-testnet.walrus.space/v1/abcde'],
];

describe('redirectToAggregatorUrlResponse', () => {
Expand Down
8 changes: 4 additions & 4 deletions portal/common/lib/resource.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ describe('fetchResource', () => {
const result = await fetchResource(mockClient, '0x1', '/path', new Set());
expect(result).toEqual({
blob_id: '0xresourceBlobId',
objectId: '0x51813e7d4040265af8bd6c757f52accbe11e6df5b9cf3d6696a96e3f54fad096',
objectId: '0x3cf9bff169db6f780a0a3cae7b3b770097c26342ad0c08604bc80728cfa37bdc',
version: undefined
});
expect(mockClient.getObject).toHaveBeenCalledWith({
id: '0x51813e7d4040265af8bd6c757f52accbe11e6df5b9cf3d6696a96e3f54fad096',
id: '0x3cf9bff169db6f780a0a3cae7b3b770097c26342ad0c08604bc80728cfa37bdc',
options: { showBcs: true },
});
});
Expand Down Expand Up @@ -127,10 +127,10 @@ describe('fetchResource', () => {
// Verify the results
expect(result).toEqual({
blob_id: '0xresourceBlobId',
objectId: '0x51813e7d4040265af8bd6c757f52accbe11e6df5b9cf3d6696a96e3f54fad096',
objectId: '0x3cf9bff169db6f780a0a3cae7b3b770097c26342ad0c08604bc80728cfa37bdc',
version: undefined
});
expect(checkRedirect).toHaveBeenCalledTimes(2);
expect(checkRedirect).toHaveBeenCalledTimes(1);
});

test('should return NOT_FOUND if the resource does not contain a blob_id', async () => {
Expand Down

0 comments on commit b16f441

Please sign in to comment.