-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(player): make
options
property public
- Loading branch information
1 parent
3c4c2f2
commit b39853b
Showing
4 changed files
with
72 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { beforeEach, describe, expect, it } from "vitest"; | ||
import { Player } from "./player"; | ||
import { PlayerManager } from "./player-manager"; | ||
|
||
describe("player manager", () => { | ||
let playerManager: PlayerManager; | ||
|
||
beforeEach(() => { | ||
playerManager = new PlayerManager(); | ||
}); | ||
|
||
it("gets and creates player", () => { | ||
const player = playerManager.get("TEST_GUILD_ID"); | ||
expect(player).toBeDefined(); | ||
expect(player.guildId).toBe("TEST_GUILD_ID"); | ||
|
||
const player2 = playerManager.get("TEST_GUILD_ID"); | ||
expect(player).toBe(player2); | ||
}); | ||
|
||
it("overrides player settings", () => { | ||
expect(playerManager.options).toBeUndefined(); | ||
|
||
playerManager = new PlayerManager({ | ||
playerDefault: { | ||
initialVolume: 123, | ||
}, | ||
}); | ||
|
||
expect(playerManager.options).toBeDefined(); | ||
expect(playerManager.options?.playerDefault?.initialVolume).toBe(123); | ||
|
||
const player = playerManager.get("TEST_GUILD_ID", { fileRoot: "./test" }); | ||
expect(player.options.initialVolume).toBe(123); | ||
expect(player.options.fileRoot).toBe("./test"); | ||
}); | ||
|
||
it("finds player", () => { | ||
let player = playerManager.find("TEST_GUILD_ID"); | ||
expect(player).toBeUndefined(); | ||
|
||
playerManager.get("TEST_GUILD_ID"); | ||
player = playerManager.find("TEST_GUILD_ID"); | ||
expect(player).toBeDefined(); | ||
}); | ||
|
||
it("removes player", () => { | ||
let player: Player | undefined = playerManager.get("TEST_GUILD_ID"); | ||
expect(player).toBeDefined(); | ||
playerManager.remove("TEST_GUILD_ID"); | ||
player = playerManager.find("TEST_GUILD_ID"); | ||
expect(player).toBeUndefined(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters