UNPKG

@ledgerhq/coin-stellar

Version:
31 lines (23 loc) 875 B
// SPDX-FileCopyrightText: © 2026 LEDGER SAS // SPDX-License-Identifier: Apache-2.0 import { isAddressValid } from './utils' import { validateAddress } from './validateAddress' jest.mock('./utils') describe('validateAddress', () => { const mockedIsAddressValid = jest.mocked(isAddressValid) beforeEach(() => { mockedIsAddressValid.mockClear() }) it.each([true, false])( 'should call isAddressValid and return expected value (%s)', async (expectedValue: boolean) => { mockedIsAddressValid.mockReturnValueOnce(expectedValue) const address = 'some random address' const parameters = {} const result = await validateAddress(address, parameters) expect(result).toEqual(expectedValue) expect(mockedIsAddressValid).toHaveBeenCalledTimes(1) expect(mockedIsAddressValid).toHaveBeenCalledWith(address) } ) })