• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

blockcoders / kuma-wallet / ebbd3c69-fda1-4bf1-80ea-77bef87d3d87

pending completion
ebbd3c69-fda1-4bf1-80ea-77bef87d3d87

Pull #8

circleci

Ruben
fix tests
Pull Request #8: Milestone 2

876 of 1103 branches covered (79.42%)

Branch coverage included in aggregate %.

3452 of 3452 new or added lines in 44 files covered. (100.0%)

6647 of 7185 relevant lines covered (92.51%)

6.69 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

91.04
/src/storage/entities/Assets.ts
1
import BaseEntity from "./BaseEntity";
2✔
2

2✔
3
interface Asset {
2✔
4
  symbol: string;
2✔
5
  address: string;
2✔
6
  decimals: number;
2✔
7
}
2✔
8

2✔
9
export default class Assets extends BaseEntity {
8✔
10
  data: {
8✔
11
    [key: string]: Asset[];
8✔
12
  };
8✔
13

8✔
14
  constructor() {
8✔
15
    super();
14✔
16
    this.data = {};
14✔
17
  }
14✔
18

8✔
19
  static async getDefaultValue<Assets>(): Promise<Assets> {
8✔
20
    return new Assets() as Assets;
2✔
21
  }
2✔
22

8✔
23
  static async init() {
8✔
24
    await Assets.set<Assets>(new Assets());
2✔
25
  }
2✔
26

8✔
27
  static async addAsset(chain: string, asset: Asset) {
8✔
28
    const assets = await Assets.get<Assets>();
×
29
    if (!assets) throw new Error("failed_to_add_assets");
×
30
    assets.addAsset(chain, asset);
×
31
    await Assets.set<Assets>(assets);
×
32
  }
×
33

8✔
34
  static async getByChain(chain: string) {
8✔
35
    const assets = await Assets.get<Assets>();
4✔
36
    if (!assets) throw new Error("failed_to_load_assets");
4✔
37
    return assets.data[chain] || [];
4!
38
  }
4✔
39

8✔
40
  addAsset(chain: string, asset: Asset) {
8✔
41
    if (!this.data[chain]) {
10✔
42
      this.data[chain] = [asset];
6✔
43
      return;
6✔
44
    }
6✔
45

4✔
46
    const _asset = this.data[chain].find(
4✔
47
      (ast) => ast.address === asset.address
4✔
48
    );
4✔
49

4✔
50
    if (_asset) throw new Error("asset_already_added");
10✔
51

2✔
52
    this.data[chain].push(asset);
2✔
53
  }
10✔
54
}
8✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc