Skip to content

Commit

Permalink
wip: test: checklist/table
Browse files Browse the repository at this point in the history
  • Loading branch information
egasimus committed May 27, 2024
1 parent 59113a7 commit 26f05b3
Showing 1 changed file with 102 additions and 0 deletions.
102 changes: 102 additions & 0 deletions test/checklist.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
#!/usr/bin/env -S node --import @ganesha/esbuild

import { Console, colors, bold } from '@hackbg/logs'
import * as SN from '@fadroma/scrt'
import * as CW from '@fadroma/cw'
import * as Namada from '@fadroma/namada'
import * as OCI from '@fadroma/oci'

const OK = colors.black.bgGreen // ok
const NO = colors.black.bgRed // test fails
const NI = colors.black.bgYellow // not implemented
const NA = colors.black.bgBlue // not applicable

const platforms = { SN, CW, Namada, OCI }

const tests: Array<[string, Function]> = [
["connect", (platform: any) => {
if (platform["connect"]) return OK
}],
["devnet", (platform: any) => {
if (platform["devnet"]) return OK
}],
["testnet", (platform: any) => {
if (platform["testnet"]) return OK
}],
["mainnet", (platform: any) => {
if (platform["mainnet"]) return OK
}],
["Chain", (platform: any) => {
if (platform["Chain"]) return OK
}],
["Chain#height", (platform: any) => {
const Chain = platform["Chain"]
const chain = new Chain({})
if (chain["height"]) return OK
}],
["Chain#nextBlock", (platform: any) => {
const Chain = platform["Chain"]
const chain = new Chain({})
if (chain["nextBlock"]) return OK
}],
["Chain#fetchBlock", (platform: any) => {
}],
["Chain#fetchBalance", (platform: any) => {
}],
["Chain#fetchCodeInfo", (platform: any) => {
}],
["Chain#fetchCodeInstances", (platform: any) => {
}],
["Chain#fetchContractInfo", (platform: any) => {
}],
["Chain#query", (platform: any) => {
}],
["Agent", (platform: any) => {
}],
["Agent#getConnection", (platform: any) => {
}],
["Agent#fetchBalance", (platform: any) => {
}],
["Agent#send", (platform: any) => {
}],
["Agent#upload", (platform: any) => {
}],
["Agent#instantiate", (platform: any) => {
}],
]

for (const [feature, test] of tests) {
process.stdout.write(bold(feature.padEnd(25)))
for (const [platformName, platform] of Object.entries(platforms)) {
let color = NI
try {
color = await Promise.resolve(test(platform)) || color
} catch (e) {
color = NO
}
process.stdout.write(color(' ' + platformName.padEnd(6) + ' '))
process.stdout.write(' ')
}
process.stdout.write('\n')
}

// For SCRT, CW, Namada, OCI:
// - connect
// - devnet
// - testnet
// - mainnet
// - Chain
// - height
// - nextBlock
// - fetchBlock
// - fetchBalance
// - fetchCodeInfo
// - fetchCodeInstances
// - fetchContractInfo
// - query
// - Agent
// - getConnection
// - fetchBalance
// - send
// - upload
// - instantiate

0 comments on commit 26f05b3

Please sign in to comment.