Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove aptos unit test for function assertions #8839

Merged
merged 14 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,15 @@ describe("LedgerAccount Test", () => {

it("builds the client properly", () => {
expect(LedgerAccount.fromLedgerConnection).toBeDefined();
expect(typeof LedgerAccount.fromLedgerConnection).toBe("function");
expect(account.init).toBeDefined();
expect(typeof account.init).toBe("function");
expect(account.toAptosAccount).toBeDefined();
expect(typeof account.toAptosAccount).toBe("function");
expect(account.hdWalletPath).toBeDefined();
expect(typeof account.hdWalletPath).toBe("function");
expect(account.address).toBeDefined();
expect(typeof account.address).toBe("function");
expect(account.authKey).toBeDefined();
expect(typeof account.authKey).toBe("function");
expect(account.pubKey).toBeDefined();
expect(typeof account.pubKey).toBe("function");
expect(account.asyncSignBuffer).toBeDefined();
expect(typeof account.asyncSignBuffer).toBe("function");
expect(account.asyncSignHexString).toBeDefined();
expect(typeof account.asyncSignHexString).toBe("function");
expect(account.signTransaction).toBeDefined();
expect(typeof account.signTransaction).toBe("function");

expect(mockedLedgerAccount).toHaveBeenCalledTimes(1);
});
Expand Down
12 changes: 0 additions & 12 deletions libs/ledger-live-common/src/families/aptos/api/index.test.ts
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the API we need to make sure we expose the correct methods as described here https://github.com/LedgerHQ/ledger-live/blob/develop/libs/coin-framework/src/api/types.ts#L31-L46

Original file line number Diff line number Diff line change
Expand Up @@ -36,34 +36,22 @@ describe("Aptos API", () => {
const api = new AptosAPI("aptos");

expect(api.broadcast).toBeDefined();
expect(typeof api.broadcast).toBe("function");
expect(api.estimateGasPrice).toBeDefined();
expect(typeof api.estimateGasPrice).toBe("function");
expect(api.generateTransaction).toBeDefined();
expect(typeof api.generateTransaction).toBe("function");
expect(api.getAccount).toBeDefined();
expect(typeof api.getAccount).toBe("function");
expect(api.getAccountInfo).toBeDefined();
expect(typeof api.getAccountInfo).toBe("function");
expect(api.simulateTransaction).toBeDefined();
expect(typeof api.simulateTransaction).toBe("function");
});

it("builds the client properly for testnet", () => {
const api = new AptosAPI("aptos_testnet");

expect(api.broadcast).toBeDefined();
expect(typeof api.broadcast).toBe("function");
expect(api.estimateGasPrice).toBeDefined();
expect(typeof api.estimateGasPrice).toBe("function");
expect(api.generateTransaction).toBeDefined();
expect(typeof api.generateTransaction).toBe("function");
expect(api.getAccount).toBeDefined();
expect(typeof api.getAccount).toBe("function");
expect(api.getAccountInfo).toBeDefined();
expect(typeof api.getAccountInfo).toBe("function");
expect(api.simulateTransaction).toBeDefined();
expect(typeof api.simulateTransaction).toBe("function");
});

describe("getAccount", () => {
Expand Down
11 changes: 0 additions & 11 deletions libs/ledger-live-common/src/families/aptos/bridge/js.test.ts
semeano marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,13 @@ describe("Aptos bridge interface ", () => {

it("should have a hydrate method that is a function", () => {
expect(bridge.currencyBridge.hydrate).toBeDefined();
expect(typeof bridge.currencyBridge.hydrate).toBe("function");
const cryptoCurrency = getCryptoCurrencyById("aptos");
const result = bridge.currencyBridge.hydrate({}, cryptoCurrency);
expect(result).toBeUndefined();
});

it("should have a scanAccounts method that is a function", () => {
expect(bridge.currencyBridge.scanAccounts).toBeDefined();
expect(typeof bridge.currencyBridge.scanAccounts).toBe("function");
const cryptoCurrency = getCryptoCurrencyById("aptos");
const deviceId = "test-device";
const result = bridge.currencyBridge.scanAccounts({
Expand All @@ -36,23 +34,14 @@ describe("Aptos bridge interface ", () => {
describe("accountBridge ", () => {
it("should contain all methods", () => {
expect(bridge.accountBridge.estimateMaxSpendable).toBeDefined();
expect(typeof bridge.accountBridge.estimateMaxSpendable).toBe("function");
expect(bridge.accountBridge.createTransaction).toBeDefined();
expect(typeof bridge.accountBridge.createTransaction).toBe("function");
expect(bridge.accountBridge.updateTransaction).toBeDefined();
expect(typeof bridge.accountBridge.updateTransaction).toBe("function");
expect(bridge.accountBridge.getTransactionStatus).toBeDefined();
expect(typeof bridge.accountBridge.getTransactionStatus).toBe("function");
expect(bridge.accountBridge.prepareTransaction).toBeDefined();
expect(typeof bridge.accountBridge.prepareTransaction).toBe("function");
expect(bridge.accountBridge.sync).toBeDefined();
expect(typeof bridge.accountBridge.sync).toBe("function");
expect(bridge.accountBridge.receive).toBeDefined();
expect(typeof bridge.accountBridge.receive).toBe("function");
expect(bridge.accountBridge.signOperation).toBeDefined();
expect(typeof bridge.accountBridge.signOperation).toBe("function");
expect(bridge.accountBridge.broadcast).toBeDefined();
expect(typeof bridge.accountBridge.broadcast).toBe("function");
});
});
describe("updateTransaction", () => {
Expand Down
Loading