Skip to content

Commit

Permalink
test(devnet): split 5-fold test
Browse files Browse the repository at this point in the history
another step towards selectable tests
  • Loading branch information
egasimus committed Oct 10, 2023
1 parent abb5207 commit a09ce42
Showing 1 changed file with 32 additions and 2 deletions.
34 changes: 32 additions & 2 deletions spec/Devnet.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,20 @@ let devnet: any

;(async () => {

await testDevnetChainId()

await testDevnetStateFile()

await testDevnetUrl()

await testDevnetContainer()

await testDevnetHighLevel()

})()

async function testDevnetChainId () {

assert.throws(
() => { devnet = new Devnet({ chainId: false as any }) },
"construct must fail if passed falsy chainId"
Expand Down Expand Up @@ -54,6 +68,10 @@ let devnet: any
"can save"
)

}

async function testDevnetStateFile () {

$(devnet.stateFile).as(TextFile).save("invalidjson")
assert.throws(
()=>{ devnet = new Devnet({ chainId: devnet.chainId }) },
Expand All @@ -71,6 +89,10 @@ let devnet: any
"can delete if state is valid json but empty"
)

}

async function testDevnetUrl () {

assert.ok(
devnet = new Devnet(),
"can construct with no options"
Expand All @@ -86,6 +108,10 @@ let devnet: any
"devnet has @hackbg/dock image"
)

}

async function testDevnetContainer () {

assert.equal(
devnet.initScriptMount, '/devnet.init.mjs',
"devnet init script mounted at default location"
Expand Down Expand Up @@ -153,9 +179,13 @@ let devnet: any
"devnet assert presence rejects if container is removed"
)

}

async function testDevnetHighLevel () {

assert.ok(
devnet = new Devnet(),
"creating yet another devnet"
"construct devnet"
)

assert.ok(
Expand Down Expand Up @@ -183,4 +213,4 @@ let devnet: any
"force deleting the devnet works"
)

})()
}

0 comments on commit a09ce42

Please sign in to comment.