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

WolferyScripting / WolferyJS / #18

01 Sep 2025 09:19PM UTC coverage: 63.335% (+3.5%) from 59.833%
#18

push

DonovanDMC
0.0.6

95 of 253 branches covered (37.55%)

Branch coverage included in aggregate %.

7592 of 11884 relevant lines covered (63.88%)

1.32 hits per line

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

73.47
/lib/models/Notes.ts
1
import type Note from "./Note.js";
1✔
2
import BaseCollectionModel from "./BaseCollectionModel.js";
1✔
3
import type WolferyJS from "../WolferyJS.js";
1✔
4
import ResourceIDs from "../generated/ResourceIDs.js";
1✔
5
import type Commands from "../util/commands.js";
1✔
6
import { type ResClient, ResRef } from "resclient-ts";
1✔
7

1✔
8
// do not edit the first line of the class comment
1✔
9
/**
1✔
10
 * All notes.
1✔
11
 * @resourceID {@link ResourceIDs.NOTES | NOTES}
1✔
12
 */
1✔
13
class Notes extends BaseCollectionModel<ResRef<Note>, typeof ResourceIDs.NOTE> {
1✔
14
    constructor(client: WolferyJS, api: ResClient, rid: string) {
1✔
15
        super(client, api, rid, item => item instanceof ResRef, {
×
16
            ridConstructor: ResourceIDs.NOTE
×
17
        });
×
18
    }
×
19

1✔
20
    protected override async _listen(on: boolean): Promise<void> {
1✔
21
        await super._listen(on, this.client.anyTracked("notes"));
×
22
    }
×
23

1✔
24
    get playerId(): string {
1✔
25
        return ResourceIDs.NOTES.parts(this.rid).id;
×
26
    }
×
27

1✔
28
    /**
1✔
29
     * Create a note for a character.
1✔
30
     * @param charId The ID of the character.
1✔
31
     * @param options The options for the note.
1✔
32
     * @playerRequired
1✔
33
     * @calls {@link PlayerCommands.setNote} > {@link fetch}
1✔
34
     */
1✔
35
    async create(charId: string, options: Commands.Player.SetNoteOptions): Promise<Note> {
1✔
36
        return this.client.commands.player.setNote(this.playerId, charId, options)
×
37
            .then(() => this.fetch(this.playerId, charId));
×
38
    }
×
39

1✔
40
    /**
1✔
41
     * Get all notes.
1✔
42
     * @calls {@link ResRef.get}
1✔
43
     */
1✔
44
    async fetchAll(): Promise<Array<Note>> {
1✔
45
        return Promise.all(this.list.map(ref => ref.get()));
×
46
    }
×
47
}
1✔
48

1✔
49
export default Notes;
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