Skip to content

Commit

Permalink
fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
konnov committed Dec 16, 2024
1 parent ed2c8c4 commit 23630d9
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 13 deletions.
6 changes: 4 additions & 2 deletions solarkraft/test/e2e/generated/setterHardcoded.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// AUTO-GENERATED by setter-populate.sh
export const SETTER_HEIGHT = 102428
export const SETTER_CONTRACT_ADDR = "CATRQFD3OSJNNKES4W4PZOGS34C324WTHV63ZCJBGQVUE7WR74NGCMNZ"
export const SETTER_WASM_HASH = "9175f9ecd34de878d195e3ae9c45466a4e6342e9c0b8d8f4358e13e4a92f1d28"
export const SETTER_CONTRACT_ADDR =
'CATRQFD3OSJNNKES4W4PZOGS34C324WTHV63ZCJBGQVUE7WR74NGCMNZ'
export const SETTER_WASM_HASH =
'9175f9ecd34de878d195e3ae9c45466a4e6342e9c0b8d8f4358e13e4a92f1d28'
33 changes: 22 additions & 11 deletions solarkraft/test/e2e/verify.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,13 @@ describe('fetches the setter contract', () => {
// Wait until the directory is created.
// In the worst case, the test suite times out.
let remainingSec = waitTimeout
while (remainingSec > 0) {
while (remainingSec > 0) {
try {
const stats = await stat(contractDir)
if (stats.isDirectory()) {
const fileCount =
(await readdir(contractDir, { withFileTypes: true }))
.filter(item => item.isDirectory()).length
const fileCount = (
await readdir(contractDir, { withFileTypes: true })
).filter((item) => item.isDirectory()).length
if (fileCount >= expectedTransactions) {
// the directory exists and it contains the required number of files
return
Expand All @@ -163,23 +163,31 @@ describe('fetches the setter contract', () => {
// ENOENT means the directory does not exist yet, so we continue waiting
}
// sleep for 1 sec
await new Promise(resolve => setTimeout(resolve, 1000))
await new Promise((resolve) => setTimeout(resolve, 1000))
remainingSec -= 1000
}
}

// we need this to run the loop below
it(`fetched ${expectedTransactions} transactions`, async function done () {
it(`fetched ${expectedTransactions} transactions`, async function done() {
this.timeout(timeout)
await waitForEntries(timeout)
// count the entries via yieldListEntriesForContract
let txCount = 0
for (const e of yieldListEntriesForContract(SETTER_CONTRACT_ADDR, contractDir)) {
assert(e.contractId === SETTER_CONTRACT_ADDR,
`transaction ${e.txHash} has wrong contractId = ${e.contractId}`)
for (const e of yieldListEntriesForContract(
SETTER_CONTRACT_ADDR,
contractDir
)) {
assert(
e.contractId === SETTER_CONTRACT_ADDR,
`transaction ${e.txHash} has wrong contractId = ${e.contractId}`
)
txCount++
}
assert(txCount === expectedTransactions, `expected ${expectedTransactions} transactions`)
assert(
txCount === expectedTransactions,
`expected ${expectedTransactions} transactions`
)
done()
})

Expand All @@ -189,7 +197,10 @@ describe('fetches the setter contract', () => {
})

// dynamically add a test for each transaction, so they can be run asynchronously
for (const e of yieldListEntriesForContract(SETTER_CONTRACT_ADDR, contractDir)) {
for (const e of yieldListEntriesForContract(
SETTER_CONTRACT_ADDR,
contractDir
)) {
it(`verify fetched transaction ${e.txHash}`, function (done) {
this.timeout(timeout)
spawn(
Expand Down

0 comments on commit 23630d9

Please sign in to comment.