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

WolferyScripting / WolferyJS / #13

28 Aug 2025 08:28PM UTC coverage: 59.188% (+3.8%) from 55.392%
#13

push

DonovanDMC
0.0.4

88 of 170 branches covered (51.76%)

Branch coverage included in aggregate %.

4608 of 7764 relevant lines covered (59.35%)

1.51 hits per line

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

89.47
/lib/models/BaseCollectionModel.ts
1
import type WolferyJS from "../WolferyJS.js";
1✔
2
import { ridOnlyClassAndList } from "../util/Util.js";
1✔
3
import CollectionListeners from "../util/CollectionListeners.js";
1✔
4
import { Properties, type ResClient, ResCollectionModel, type ResModelOptions } from "resclient-ts";
1✔
5
import util, { type InspectOptions } from "node:util";
1✔
6

1✔
7
export default class BaseCollectionModel<T = unknown> extends ResCollectionModel<T> {
1✔
8
    protected client!: WolferyJS;
1✔
9
    listeners!: CollectionListeners<this>;
1✔
10
    constructor(client: WolferyJS, api: ResClient, rid: string, validateItem: (item: T) => boolean, options?: Omit<ResModelOptions, "definition">) {
1✔
11
        super(api, rid, validateItem, options);
1✔
12
        Properties.of(this)
1✔
13
            .readOnly("client", client)
1✔
14
            .readOnly("listeners", new CollectionListeners(this));
1✔
15
    }
1✔
16

1✔
17
    protected override async _listen(on: boolean): Promise<void> {
1✔
18
        await super._listen(on);
1✔
19
        if (on) this.listeners.activate();
1✔
20
        else this.listeners.deactivate();
×
21
    }
1✔
22
}
1✔
23

1✔
24
export function enableCustomInspectForCollectionModels(): void {
1✔
25
    if (util.inspect.custom in BaseCollectionModel.prototype) return;
4✔
26
    Object.defineProperty(BaseCollectionModel.prototype, util.inspect.custom, {
1✔
27
        value(this: BaseCollectionModel, depth: number, inspectOptions: InspectOptions, inspect: typeof util.inspect): string {
1✔
28
            return inspect(ridOnlyClassAndList(this.constructor as typeof BaseCollectionModel, this.rid, this.list), inspectOptions);
×
29
        }
×
30
    });
1✔
31
}
1✔
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

© 2026 Coveralls, Inc