Skip to content

Commit

Permalink
chore(core-state): remove valuesByIndex (#4383)
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastijankuzner authored May 13, 2021
1 parent 03f0354 commit 4f6cc0b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
10 changes: 5 additions & 5 deletions __tests__/unit/core-state/wallets/wallet-repository.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,11 +281,11 @@ describe("Wallet Repository", () => {
);
});

describe("valuesByIndex", () => {
describe("allByIndex", () => {
it("should return values on index", () => {
const wallet = walletRepo.findByAddress("address");

expect(walletRepo.valuesByIndex("addresses")).toEqual([wallet]);
expect(walletRepo.allByIndex("addresses")).toEqual([wallet]);
});
});

Expand All @@ -294,18 +294,18 @@ describe("Wallet Repository", () => {
const wallet = walletRepo.findByAddress("address");
walletRepo.setOnIndex("addresses", "address2", wallet);

expect(walletRepo.valuesByIndex("addresses")).toEqual([wallet, wallet]);
expect(walletRepo.allByIndex("addresses")).toEqual([wallet, wallet]);
});
});

describe("forgetOnIndex", () => {
it("should forget wallet on index", () => {
const wallet = walletRepo.findByAddress("address");
expect(walletRepo.valuesByIndex("addresses")).toEqual([wallet]);
expect(walletRepo.allByIndex("addresses")).toEqual([wallet]);

walletRepo.forgetOnIndex("addresses", "address");

expect(walletRepo.valuesByIndex("addresses")).toEqual([]);
expect(walletRepo.allByIndex("addresses")).toEqual([]);
});
});
});
2 changes: 0 additions & 2 deletions packages/core-kernel/src/contracts/state/wallets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,6 @@ export interface WalletRepository {

index(wallet: Wallet): void;

valuesByIndex(index: string): ReadonlyArray<Wallet>;

setOnIndex(index: string, key: string, wallet: Wallet): void;

forgetOnIndex(index: string, key: string): void;
Expand Down
4 changes: 0 additions & 4 deletions packages/core-state/src/wallets/wallet-repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,6 @@ export class WalletRepository implements Contracts.State.WalletRepository {
}
}

public valuesByIndex(index: string): ReadonlyArray<Contracts.State.Wallet> {
return this.getIndex(index).values();
}

public setOnIndex(index: string, key: string, wallet: Contracts.State.Wallet): void {
this.getIndex(index).set(key, wallet);
}
Expand Down

0 comments on commit 4f6cc0b

Please sign in to comment.