@ledgerhq/coin-stellar
Version:
Ledger Stellar Coin integration
37 lines • 1.4 kB
JavaScript
import { firstValueFrom, reduce } from "rxjs";
import { createBridges } from "../bridge/index";
import { createFixtureAccount } from "../types/bridge.fixture";
const defaultSyncConfig = {
paginationConfig: {},
blacklistedTokenIds: [],
};
function syncAccount(bridge, account, syncConfig = defaultSyncConfig) {
return firstValueFrom(bridge.sync(account, syncConfig).pipe(reduce((a, f) => f(a), account)));
}
const dummyAccount = createFixtureAccount();
describe("Sync Accounts", () => {
let bridge;
beforeAll(() => {
const signer = jest.fn();
const coinConfig = () => ({
status: { type: "active" },
explorer: {
url: "https://stellar.coin.ledger.com",
fetchLimit: 100,
},
});
bridge = createBridges(signer, coinConfig);
});
test.each([
"GAT4LBXYJGJJJRSNK74NPFLO55CDDXSYVMQODSEAAH3M6EY4S7LPH5GV",
"GCDDN6T2LJN3T7SPWJQV6BCCL5KNY5GBN7X4CMSZLDEXDHXAH32TOAHS",
])("should always be sync without error for address %s", async (accountId) => {
const account = await syncAccount(bridge.accountBridge, {
...dummyAccount,
id: `js:2:stellar:${accountId}:`,
freshAddress: accountId,
});
expect(account.id).toEqual(`js:2:stellar:${accountId}:`);
});
});
//# sourceMappingURL=synchronization.integ.test.js.map