Skip to content
This repository has been archived by the owner on Oct 31, 2024. It is now read-only.

Commit

Permalink
feat: filter registered subnets internal only (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastiendan authored Oct 12, 2023
1 parent ec484ee commit af9f9ca
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion packages/frontend/src/hooks/useRegisteredSubnets.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ const registeredSubnets: { [x: string]: Subnet } = {
logoURL: '',
name: 'subnetMock',
},
incal: {
chainId: BigNumber.from(2),
currencySymbol: 'TST2',
endpoint: '',
logoURL: '',
name: 'Incal',
},
}

const subnetIdsByIndexes = ['subnet1', 'subnet2']
Expand Down Expand Up @@ -78,6 +85,8 @@ describe('useRegisteredSubnets', () => {
expect(subnetsMock).toHaveBeenCalledWith('subnet1')
expect(subnetsMock).toHaveBeenCalledWith('subnet2')
expect(result.current.loading).toBe(false)
expect(result.current.registeredSubnets).toStrictEqual(expectedSubnets)
expect(result.current.registeredSubnets).toStrictEqual(
expectedSubnets.filter((s) => s.name === 'Incal')
)
})
})
2 changes: 1 addition & 1 deletion packages/frontend/src/hooks/useRegisteredSubnets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export default function useRegisteredSubnets() {
values
.filter((v) => v.status === 'fulfilled')
.map((v) => (v.status === 'fulfilled' ? v.value : undefined))
.filter((v) => v)
.filter((v) => v && v.name === 'Incal')
)
setRegisteredSubnets(subnets as SubnetWithId[])
}
Expand Down

0 comments on commit af9f9ca

Please sign in to comment.