-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b4d140f
commit 6eb289e
Showing
2 changed files
with
68 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,86 @@ | ||
import { web3 } from '@project-serum/anchor' | ||
import * as Solana from '~/libraries/Solana/Solana' | ||
|
||
describe('Solana.getClusterFromNetworkConfig', () => { | ||
test('0', () => { | ||
const result: any = Solana.getClusterFromNetworkConfig('mainnet-beta') | ||
expect(result).toMatchSnapshot() | ||
}) | ||
}) | ||
test('1', () => { | ||
const result: any = Solana.getClusterFromNetworkConfig('testnet') | ||
expect(result).toMatchSnapshot() | ||
}) | ||
|
||
test('2', () => { | ||
const result: any = Solana.getClusterFromNetworkConfig('West') | ||
expect(result).toMatchSnapshot() | ||
}) | ||
|
||
test('3', () => { | ||
const result: any = Solana.getClusterFromNetworkConfig('North') | ||
expect(result).toMatchSnapshot() | ||
}) | ||
|
||
test('4', () => { | ||
const result: any = Solana.getClusterFromNetworkConfig('') | ||
expect(result).toMatchSnapshot() | ||
}) | ||
|
||
describe('Solana.sleep', () => { | ||
test('0', () => { | ||
const result: any = Solana.sleep(0) | ||
expect(result).toMatchSnapshot() | ||
}) | ||
|
||
test('1', () => { | ||
const result: any = Solana.getClusterFromNetworkConfig('testnet') | ||
const result: any = Solana.sleep(-5.48) | ||
expect(result).toMatchSnapshot() | ||
}) | ||
|
||
test('2', () => { | ||
const result: any = Solana.getClusterFromNetworkConfig('West') | ||
const result: any = Solana.sleep(-100) | ||
expect(result).toMatchSnapshot() | ||
}) | ||
|
||
test('3', () => { | ||
const result: any = Solana.getClusterFromNetworkConfig('North') | ||
const result: any = Solana.sleep(-Infinity) | ||
expect(result).toMatchSnapshot() | ||
}) | ||
}) | ||
|
||
test('4', () => { | ||
const result: any = Solana.getClusterFromNetworkConfig('') | ||
expect(result).toMatchSnapshot() | ||
describe('Solana.publicKeyFromSeeds', () => { | ||
test('0', async () => { | ||
const inst: any = new Uint8Array([0, -100]) | ||
const inst2: any = new Uint8Array([-100, -100]) | ||
const inst3: any = new Uint8Array([-1, -1]) | ||
const inst4: any = new Uint8Array([0, 100]) | ||
const param1: any = [inst, inst2, inst3, inst4] | ||
const param3: any = new web3.PublicKey(1) | ||
await Solana.publicKeyFromSeeds(param1, 'This is a Text', param3) | ||
}) | ||
|
||
describe('Solana.sleep', () => { | ||
test('0', () => { | ||
const result: any = Solana.sleep(0) | ||
expect(result).toMatchSnapshot() | ||
}) | ||
|
||
test('1', () => { | ||
const result: any = Solana.sleep(-5.48) | ||
expect(result).toMatchSnapshot() | ||
}) | ||
|
||
test('2', () => { | ||
const result: any = Solana.sleep(-100) | ||
expect(result).toMatchSnapshot() | ||
describe('Solana.publicKeyFromSeeds', () => { | ||
test('0', async () => { | ||
const inst: any = new Uint8Array([0, -100]) | ||
const inst2: any = new Uint8Array([-100, -100]) | ||
const inst3: any = new Uint8Array([-1, -1]) | ||
const inst4: any = new Uint8Array([0, 100]) | ||
const param1: any = [inst, inst2, inst3, inst4] | ||
const param3: any = new web3.PublicKey(1) | ||
await Solana.publicKeyFromSeeds(param1, 'This is a Text', param3) | ||
}) | ||
}) | ||
|
||
test('3', () => { | ||
const result: any = Solana.sleep(-Infinity) | ||
expect(result).toMatchSnapshot() | ||
describe('Solana.publicKeyFromSeeds', () => { | ||
test('0', async () => { | ||
const inst: any = new Uint8Array([0, -100]) | ||
const inst2: any = new Uint8Array([-100, -100]) | ||
const inst3: any = new Uint8Array([-1, -1]) | ||
const inst4: any = new Uint8Array([0, 100]) | ||
const param1: any = [inst, inst2, inst3, inst4] | ||
const param3: any = new web3.PublicKey(1) | ||
await Solana.publicKeyFromSeeds(param1, 'This is a Text', param3) | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Solana.getClusterFromNetworkConfig 0 1`] = `"mainnet-beta"`; | ||
exports[`1 1`] = `"testnet"`; | ||
|
||
exports[`Solana.getClusterFromNetworkConfig 1 1`] = `"testnet"`; | ||
exports[`2 1`] = `"devnet"`; | ||
|
||
exports[`Solana.getClusterFromNetworkConfig 2 1`] = `"devnet"`; | ||
exports[`3 1`] = `"devnet"`; | ||
|
||
exports[`Solana.getClusterFromNetworkConfig 3 1`] = `"devnet"`; | ||
exports[`4 1`] = `"devnet"`; | ||
|
||
exports[`Solana.getClusterFromNetworkConfig 4 1`] = `"devnet"`; | ||
exports[`Solana.getClusterFromNetworkConfig 0 1`] = `"mainnet-beta"`; | ||
|
||
exports[`Solana.getClusterFromNetworkConfig Solana.sleep 0 1`] = `Promise {}`; | ||
exports[`Solana.sleep 0 1`] = `Promise {}`; | ||
|
||
exports[`Solana.getClusterFromNetworkConfig Solana.sleep 1 1`] = `Promise {}`; | ||
exports[`Solana.sleep 1 1`] = `Promise {}`; | ||
|
||
exports[`Solana.getClusterFromNetworkConfig Solana.sleep 2 1`] = `Promise {}`; | ||
exports[`Solana.sleep 2 1`] = `Promise {}`; | ||
|
||
exports[`Solana.getClusterFromNetworkConfig Solana.sleep 3 1`] = `Promise {}`; | ||
exports[`Solana.sleep 3 1`] = `Promise {}`; |