Skip to content

Commit

Permalink
test: readd solana test for disabled network
Browse files Browse the repository at this point in the history
  • Loading branch information
zoruka committed Sep 26, 2024
1 parent 8981fe0 commit d64fac6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 18 deletions.
12 changes: 1 addition & 11 deletions apps/laboratory/src/pages/library/solana.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createAppKit, type CaipNetwork } from '@reown/appkit/react'
import { createAppKit } from '@reown/appkit/react'
import { SolanaAdapter } from '@reown/appkit-adapter-solana/react'
import { ThemeStore } from '../../utils/StoreUtil'
import { ConstantsUtil } from '../../utils/ConstantsUtil'
Expand All @@ -14,16 +14,6 @@ const solanaWeb3JsAdapter = new SolanaAdapter({
wallets: [new HuobiWalletAdapter(), new SolflareWalletAdapter()]
})

export const solanaNotExist = {
id: 'solana:chaindoesntexist',
chainId: 'chaindoesntexist',
name: 'Solana Unsupported',
currency: 'SOL',
explorerUrl: 'https://explorer.solana.com/?cluster=devnet',
rpcUrl: '',
chainNamespace: 'solana'
} as CaipNetwork

const modal = createAppKit({
adapters: [solanaWeb3JsAdapter],
networks,
Expand Down
14 changes: 13 additions & 1 deletion apps/laboratory/src/utils/ConstantsUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
gnosis
} from '@reown/appkit/networks'
import { getLocalStorageItem } from './LocalStorage'
import type { CaipNetwork } from '@reown/appkit'

const projectId = process.env['NEXT_PUBLIC_PROJECT_ID']
if (!projectId) {
Expand Down Expand Up @@ -50,7 +51,18 @@ if (typeof window !== 'undefined') {
const customWallet = storedCustomWallet ? [JSON.parse(storedCustomWallet)] : []

const EvmNetworks = [mainnet, optimism, polygon, zkSync, arbitrum, base, sepolia, gnosis]
const SolanaNetworks = [solana, solanaTestnet, solanaDevnet]

export const solanaNotExist = {
id: 'solana:chaindoesntexist',
chainId: 'chaindoesntexist',
name: 'Solana Unsupported',
currency: 'SOL',
explorerUrl: 'https://explorer.solana.com/?cluster=unsupported',
rpcUrl: 'https://api.unsupported.solana.com',
chainNamespace: 'solana'
} as CaipNetwork

const SolanaNetworks = [solana, solanaTestnet, solanaDevnet, solanaNotExist]

export const ConstantsUtil = {
SigningSucceededToastTitle: 'Signing Succeeded',
Expand Down
7 changes: 1 addition & 6 deletions apps/laboratory/tests/wallet.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,7 @@ sampleWalletTest('it should fetch balance as expected', async ({ library }) => {
})

sampleWalletTest('it should show disabled networks', async ({ library }) => {
if (library === 'solana') {
// Solana doesn't have disabled networks
return
}

const disabledNetworks = 'Gnosis'
const disabledNetworks = library === 'solana' ? 'Solana Unsupported' : 'Gnosis'

await modalPage.openModal()
await modalPage.openNetworks()
Expand Down

0 comments on commit d64fac6

Please sign in to comment.