Skip to content

Commit

Permalink
Better test cases for edge cases
Browse files Browse the repository at this point in the history
  • Loading branch information
JoelBCarter committed Sep 24, 2024
1 parent 7538b99 commit cf6b84a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,16 @@ describe('addressesContainsAll', () => {
['with single wallet', () => oneWallet],
['with multiple wallets', () => twoWallets],
]
it('with no signers and empty addresses supplied', async () => {
const bw = await buildBoundWitness([])
expect(addressesContainsAll(bw, [])).toBeTrue()
})
describe.each(cases)('%s', (_, wallets) => {
let addresses: Address[]
beforeAll(() => {
addresses = wallets().map(x => x.address)
})
it('with no signers and empty addresses supplied', async () => {
it('with all wallets as signers and empty addresses supplied', async () => {
const bw = await buildBoundWitness(wallets())
expect(addressesContainsAll(bw, [])).toBeTrue()
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ describe('addressesContainsAny', () => {
['with single wallet', () => oneWallet],
['with multiple wallets', () => twoWallets],
]
it('with no signers and empty addresses supplied', async () => {
const bw = await buildBoundWitness([])
expect(addressesContainsAny(bw, [])).toBeFalse() // No signers and no addresses should return false
})
describe.each(cases)('%s', (_, wallets) => {
let addresses: Address[]
beforeAll(() => {
addresses = wallets().map(x => x.address)
})
it('with no signers and empty addresses supplied', async () => {
const bw = await buildBoundWitness([])
expect(addressesContainsAny(bw, [])).toBeFalse() // No signers and no addresses should return false
})
it('with all wallets as signers and all wallet addresses supplied', async () => {
const bw = await buildBoundWitness(wallets())
expect(addressesContainsAny(bw, addresses)).toBeTrue() // Should be true if wallets exist
Expand Down

0 comments on commit cf6b84a

Please sign in to comment.