Skip to content

Commit

Permalink
test: run all tests (or just what is selected)
Browse files Browse the repository at this point in the history
upgraded @hackbg/ensuite test runner
  • Loading branch information
egasimus committed Oct 23, 2023
1 parent adfd12c commit cf32d98
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 44 deletions.
4 changes: 2 additions & 2 deletions agent/agent.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import {
import assert from 'node:assert'
import { fixture } from '../fixtures/fixtures'

import { TestSuite } from '@hackbg/ensuite'
export default new TestSuite(import.meta.url, [
import { Suite } from '@hackbg/ensuite'
export default new Suite([
['errors', testAgentErrors],
['console', testAgentConsole],
['chain', testChain],
Expand Down
6 changes: 4 additions & 2 deletions connect/connect.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import connect, { ConnectConfig, ConnectError, ConnectConsole } from './connect'
import * as assert from 'node:assert'

import { TestSuite } from '@hackbg/ensuite'
export default new TestSuite(import.meta.url, [
import { Suite } from '@hackbg/ensuite'
export default new Suite([
['chains', testConnectChains],
['config', testConnectConfig],
['errors', testConnectErrors],
['console', testConnectConsole],
['scrt', () => import('./scrt/scrt.test')],
['cw', () => import('./cw/cw.test')]
])

export async function testConnectChains () {
Expand Down
10 changes: 2 additions & 8 deletions connect/cw/cw.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Devnet, CW } from '@hackbg/fadroma'
import { TestSuite } from '@hackbg/ensuite'
export default new TestSuite(import.meta.url, [
['docs', testCWDocs],
import { Suite } from '@hackbg/ensuite'
export default new Suite([
['signer', testCWSigner]
])

Expand All @@ -12,11 +11,6 @@ const mnemonic = [
'angry tiny foil prosper water news'
].join(' ')

export async function testCWDocs () {
//@ts-ignore
await import('./CW.spec.ts.md')
}

export async function testCWSigner () {
const devnet = await new Devnet({ platform: 'okp4_5.0' }).create()
const chain = devnet.getChain()
Expand Down
4 changes: 2 additions & 2 deletions connect/scrt/scrt.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ let chain: any // for mocking
let agent: Agent
const mnemonic = 'define abandon palace resource estate elevator relief stock order pool knock myth brush element immense task rapid habit angry tiny foil prosper water news'

import { TestSuite } from '@hackbg/ensuite'
export default new TestSuite(import.meta.url, [
import { Suite } from '@hackbg/ensuite'
export default new Suite([
['devnet', testScrtDevnet],
['fees', testScrtFees],
['batches', testScrtBatches],
Expand Down
2 changes: 1 addition & 1 deletion connect/scrt/secretjs-esm
Submodule secretjs-esm updated 1 files
+0 −4,892 yarn.lock
2 changes: 1 addition & 1 deletion ensuite
Submodule ensuite updated 4 files
+4 −4 ensuite.d.ts
+127 −39 ensuite.mjs
+27 −0 ensuite.test.mjs
+4 −1 package.json
14 changes: 10 additions & 4 deletions fadroma-devnet.test.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
import Project, {
packageRoot, getDevnet, Devnet, Template, build, Uploader, Agent
getDevnet, Devnet, Template, build, Uploader, Agent
} from '@hackbg/fadroma'
import type { DevnetPlatform } from '@hackbg/fadroma'

import * as assert from 'node:assert'
import { getuid, getgid } from 'node:process'
import { resolve } from 'node:path'
import { dirname, resolve } from 'node:path'
import { fileURLToPath } from 'node:url'

import $, { TextFile, JSONFile, JSONDirectory } from '@hackbg/file'
import { Image, Container } from '@hackbg/dock'

import { TestSuite } from '@hackbg/ensuite'
export default new TestSuite(import.meta.url, [
/** Root of installed Fadroma package. */
//@ts-ignore
export const packageRoot = dirname(resolve(fileURLToPath(import.meta.url)))

import { Suite } from '@hackbg/ensuite'
export default new Suite([
['scrt', ()=>testDevnetPlatform('scrt_1.9')],
['okp4', ()=>testDevnetPlatform('okp4_5.0')],
['chain-id', testDevnetChainId],
Expand Down Expand Up @@ -114,6 +119,7 @@ export async function testDevnetContainer () {
)
const spawnEnv = {
DAEMON: 'secretd',
TOKEN: 'uscrt',
CHAIN_ID: devnet.chainId,
ACCOUNTS: devnet.accounts.join(' '),
STATE_UID: String(getuid!()),
Expand Down
40 changes: 16 additions & 24 deletions fadroma.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,23 @@ import type { Agent } from '@fadroma/agent'
import $, { OpaqueDirectory, withTmpDir } from '@hackbg/file'
import * as Dock from '@hackbg/dock'
import { fixture } from './fixtures/fixtures'
import { TestSuite } from '@hackbg/ensuite'
import { dirname, resolve } from 'node:path'
import { fileURLToPath } from 'node:url'

/** Root of installed Fadroma package. */
//@ts-ignore
export const packageRoot = dirname(resolve(fileURLToPath(import.meta.url)))
import { Suite } from '@hackbg/ensuite'
export default new Suite([
['agent', () => import('./agent/agent.test')],
['connect', () => import('./connect/connect.test')],
['devnet', () => import('./fadroma-devnet.test')],
['wizard', testProjectWizard],
['collections', testCollections],
//['project', testProject],
['deployment', testDeployment],
['deploy-store', testDeployStore],
['build', testBuild],
['upload', testUpload],
['upload-store', testUploadStore],
//['factory', () => import ('./Factory.spec.ts.md')],
//['impl', () => import('./Implementing.spec.ts.md')],
])

export async function testCollections () {

Expand Down Expand Up @@ -271,21 +281,3 @@ export async function testProjectWizard () {
'test4'
) instanceof Project)
}

export default new TestSuite(import.meta.url, [
['agent', () => import('./agent/agent.test')],
['connect', () => import('./connect/connect.test')],
['cw', () => import('./connect/cw/cw.test')],
['scrt', () => import('./connect/scrt/scrt.test')],
['devnet', () => import('./fadroma-devnet.test')],
['wizard', testProjectWizard],
['collections', testCollections],
//['project', testProject],
['deployment', testDeployment],
['deploy-store', testDeployStore],
['build', testBuild],
['upload', testUpload],
['upload-store', testUploadStore],
//['factory', () => import ('./Factory.spec.ts.md')],
//['impl', () => import('./Implementing.spec.ts.md')],
])

0 comments on commit cf32d98

Please sign in to comment.