Skip to content

Commit

Permalink
🚧 Loose ends in tests (#320)
Browse files Browse the repository at this point in the history
  • Loading branch information
janjakubnanista authored Jan 31, 2024
1 parent a3a797a commit 3b9fd07
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 33 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/reusable-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ jobs:

- name: Test
run: pnpm test:user
env:
LAYERZERO_EXAMPLES_REPOSITORY_URL: https://github.com/${{ github.repository }}.git
LAYERZERO_EXAMPLES_REPOSITORY_REF: ${{ github.ref_name }}

# We'll collect the docker compose logs from all containers on failure
- name: Collect docker logs on failure
Expand Down
8 changes: 4 additions & 4 deletions docker-compose.registry.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,17 +84,17 @@ services:
# If these are not provided, for example if running on a local machine,
# we'll default them to our repository and and empty ref
environment:
- LAYERZERO_EXAMPLES_REPOSITORY_URL=https://github.com/${GITHUB_REPOSITORY:-LayerZero-Labs/devtools}.git
- LAYERZERO_EXAMPLES_REPOSITORY_REF=${GITHUB_REF_NAME}
- LAYERZERO_EXAMPLES_REPOSITORY_URL=${LAYERZERO_EXAMPLES_REPOSITORY_URL}
- LAYERZERO_EXAMPLES_REPOSITORY_REF=${LAYERZERO_EXAMPLES_REPOSITORY_REF}
working_dir: /app
command:
- /bin/bash
- -c
- |
pnpm config set registry http://npm-registry:4873/
echo "create-lz-oapp:repository $LAYERZERO_EXAMPLES_REPOSITORY_URL"
echo "create-lz-oapp:ref $LAYERZERO_EXAMPLES_REPOSITORY_REF"
echo "create-lz-oapp:repository ${LAYERZERO_EXAMPLES_REPOSITORY_URL}"
echo "create-lz-oapp:ref ${LAYERZERO_EXAMPLES_REPOSITORY_REF}"
/app/tests-user/lib/bats-core/bin/bats --verbose-run --recursive ./tests-user/tests
volumes:
Expand Down
71 changes: 42 additions & 29 deletions packages/protocol-devtools-evm/test/uln302/sdk.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,14 @@ describe('uln302/sdk', () => {
const ulnConfigEncodedUnsorted = ulnSdk.encodeUlnConfig(ulnConfigUnsorted)
const ulnConfigEncodedSorted = ulnSdk.encodeUlnConfig(ulnConfigSorted)
expect(ulnConfigEncodedSorted).toBe(ulnConfigEncodedUnsorted)
})
}),
{ numRuns: 20 }
)
})
})

describe('setDefaultUlnConfig', () => {
it('should sort requiredDVNs and optionalDVNs', async () => {
const encodeFunctionData = jest.spyOn(contract.interface, 'encodeFunctionData')

await fc.assert(
fc.asyncProperty(endpointArbitrary, dvnsArbitrary, async (eid, dvns) => {
const sortedDvns = [...dvns].sort((a, b) => a.localeCompare(b))
Expand All @@ -98,22 +97,25 @@ describe('uln302/sdk', () => {
expect(transactionUnsorted).toEqual(transactionsSorted)

// And let's check that the encoding call is correct and the DVNs are sorted
expect(encodeFunctionData).toHaveBeenLastCalledWith('setDefaultUlnConfigs', [
[
{
eid,
config: {
confirmations: BigInt(100),
optionalDVNThreshold: 0,
optionalDVNs: sortedDvns.map(addChecksum),
requiredDVNs: sortedDvns.map(addChecksum),
requiredDVNCount: sortedDvns.length,
optionalDVNCount: sortedDvns.length,
expect(transactionsSorted.data).toBe(
contract.interface.encodeFunctionData('setDefaultUlnConfigs', [
[
{
eid,
config: {
confirmations: BigInt(100),
optionalDVNThreshold: 0,
optionalDVNs: sortedDvns.map(addChecksum),
requiredDVNs: sortedDvns.map(addChecksum),
requiredDVNCount: sortedDvns.length,
optionalDVNCount: sortedDvns.length,
},
},
},
],
])
})
],
])
)
}),
{ numRuns: 20 }
)
})
})
Expand Down Expand Up @@ -150,7 +152,8 @@ describe('uln302/sdk', () => {

await expect(ulnSdk.hasAppUlnConfig(eid, oapp, ulnConfig)).resolves.toBeTruthy()
}
)
),
{ numRuns: 20 }
)
})

Expand All @@ -172,7 +175,8 @@ describe('uln302/sdk', () => {
})
).resolves.toBeTruthy()
}
)
),
{ numRuns: 20 }
)
})

Expand All @@ -194,7 +198,8 @@ describe('uln302/sdk', () => {
})
).resolves.toBeTruthy()
}
)
),
{ numRuns: 20 }
)
})

Expand All @@ -216,7 +221,8 @@ describe('uln302/sdk', () => {
})
).resolves.toBeTruthy()
}
)
),
{ numRuns: 20 }
)
})

Expand All @@ -240,7 +246,8 @@ describe('uln302/sdk', () => {
})
).resolves.toBeFalsy()
}
)
),
{ numRuns: 20 }
)
})

Expand All @@ -264,7 +271,8 @@ describe('uln302/sdk', () => {
})
).resolves.toBeFalsy()
}
)
),
{ numRuns: 20 }
)
})

Expand All @@ -286,7 +294,8 @@ describe('uln302/sdk', () => {
})
).resolves.toBeFalsy()
}
)
),
{ numRuns: 20 }
)
})

Expand All @@ -308,7 +317,8 @@ describe('uln302/sdk', () => {
})
).resolves.toBeFalsy()
}
)
),
{ numRuns: 20 }
)
})
})
Expand Down Expand Up @@ -341,7 +351,8 @@ describe('uln302/sdk', () => {

await expect(ulnSdk.hasAppExecutorConfig(eid, oapp, executorConfig)).resolves.toBeTruthy()
}
)
),
{ numRuns: 20 }
)
})

Expand All @@ -362,7 +373,8 @@ describe('uln302/sdk', () => {
})
).resolves.toBeTruthy()
}
)
),
{ numRuns: 20 }
)
})

Expand All @@ -384,7 +396,8 @@ describe('uln302/sdk', () => {
})
).resolves.toBeTruthy()
}
)
),
{ numRuns: 20 }
)
})
})
Expand Down

0 comments on commit 3b9fd07

Please sign in to comment.