-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #92 from initia-labs/feat/tests
Feat/tests
- Loading branch information
Showing
157 changed files
with
1,719 additions
and
850 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { APIRequester } from '../APIRequester' | ||
import { AuctionAPI } from './AuctionAPI' | ||
import { AuctionParams } from '../../../core' | ||
|
||
const c = new APIRequester('https://rest.testnet.initia.xyz') | ||
const api = new AuctionAPI(c) | ||
|
||
describe('AuctionAPI', () => { | ||
it('params', async () => { | ||
const params = await api.parameters() | ||
expect(params).toEqual(expect.any(AuctionParams)) | ||
}) | ||
}) |
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
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,42 +1,37 @@ | ||
import { APIRequester } from '../APIRequester' | ||
import { AuthAPI } from './AuthAPI' | ||
import { BaseAccount } from '../../../core' | ||
import { AuthParams, BaseAccount } from '../../../core' | ||
import { MnemonicKey } from '../../../key' | ||
|
||
const c = new APIRequester('https://rest.devnet.initia.xyz') | ||
const auth = new AuthAPI(c) | ||
const c = new APIRequester('https://rest.testnet.initia.xyz') | ||
const api = new AuthAPI(c) | ||
|
||
describe('AuthAPI', () => { | ||
describe('accounts', () => { | ||
it('account exists', async () => { | ||
const acct = await auth.accountInfo( | ||
const acct = await api.accountInfo( | ||
'init1hk0asaef9nxvnj7gjwawv0zz0yd7adcysktpqu' | ||
) | ||
|
||
expect(acct instanceof BaseAccount).toBe(true) | ||
}) | ||
|
||
it('invalid account', async () => { | ||
await expect(auth.accountInfo('1234')).rejects.toThrow() | ||
await expect(api.accountInfo('1234')).rejects.toThrow() | ||
}) | ||
|
||
it("account doesn't exist (valid but new account)", async () => { | ||
const mk = new MnemonicKey() | ||
await expect(auth.accountInfo(mk.accAddress)).rejects.toThrow( | ||
await expect(api.accountInfo(mk.accAddress)).rejects.toThrow( | ||
'status code 404' | ||
) | ||
}) | ||
}) | ||
|
||
describe('parameters', () => { | ||
it('parameters', async () => { | ||
const param = await auth.parameters() | ||
|
||
expect(param.max_memo_characters).toBeGreaterThanOrEqual(0) | ||
expect(param.tx_sig_limit).toBeGreaterThanOrEqual(0) | ||
expect(param.tx_size_cost_per_byte).toBeGreaterThanOrEqual(0) | ||
expect(param.sig_verify_cost_ed25519).toBeGreaterThanOrEqual(0) | ||
expect(param.sig_verify_cost_secp256k1).toBeGreaterThanOrEqual(0) | ||
it('params', async () => { | ||
const params = await api.parameters() | ||
expect(params).toEqual(expect.any(AuthParams)) | ||
}) | ||
}) | ||
}) |
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
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
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,30 +1,30 @@ | ||
import { APIRequester } from '../APIRequester' | ||
import { BankAPI } from './BankAPI' | ||
import { BankParams } from '../../../core' | ||
|
||
const c = new APIRequester('https://rest.devnet.initia.xyz') | ||
const bank = new BankAPI(c) | ||
const c = new APIRequester('https://rest.testnet.initia.xyz') | ||
const api = new BankAPI(c) | ||
|
||
describe('BankAPI', () => { | ||
describe('balance', () => { | ||
it('account exists', async () => { | ||
await bank.balance('init1wlvk4e083pd3nddlfe5quy56e68atra3gu9xfs') | ||
await api.balance('init1wlvk4e083pd3nddlfe5quy56e68atra3gu9xfs') | ||
}) | ||
|
||
it('invalid account', async () => { | ||
await expect(bank.balance('1234')).rejects.toThrow() | ||
await expect(api.balance('1234')).rejects.toThrow() | ||
}) | ||
}) | ||
|
||
it('total supply', async () => { | ||
const totalSupply = await bank.total() | ||
const totalSupply = await api.total() | ||
expect(totalSupply[0].toArray().length).toBeGreaterThan(0) | ||
}) | ||
|
||
describe('parameters', () => { | ||
it('parameters', async () => { | ||
const param = await bank.parameters() | ||
|
||
expect(param.default_send_enabled).toBeDefined() | ||
it('params', async () => { | ||
const params = await api.parameters() | ||
expect(params).toEqual(expect.any(BankParams)) | ||
}) | ||
}) | ||
}) |
Oops, something went wrong.