mirror of
https://github.com/ZHANGTIANYAO1/teamspeak-music-bot.git
synced 2026-10-02 04:52:50 +08:00
feat: add music source service — NetEase/QQ providers, unified interface, cookie auth
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
17d2decc91
commit
94902fc2c4
8 files changed
+2081
-3
No files matched your search
@@ -0,0 +1,31 @@
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { parseLyrics } from "./netease.js";
|
||||
|
||||
describe("NetEase adapter", () => {
|
||||
it("parses LRC format lyrics", () => {
|
||||
const lrc = `[00:00.00] 作词 : 周杰伦
|
||||
[00:01.00] 作曲 : 周杰伦
|
||||
[00:12.50]故事的小黄花
|
||||
[00:15.80]从出生那年就飘着`;
|
||||
|
||||
const lines = parseLyrics(lrc);
|
||||
expect(lines).toHaveLength(2);
|
||||
expect(lines[0].time).toBeCloseTo(12.5, 1);
|
||||
expect(lines[0].text).toBe("故事的小黄花");
|
||||
expect(lines[1].time).toBeCloseTo(15.8, 1);
|
||||
expect(lines[1].text).toBe("从出生那年就飘着");
|
||||
});
|
||||
|
||||
it("handles empty lyrics", () => {
|
||||
const lines = parseLyrics("");
|
||||
expect(lines).toHaveLength(0);
|
||||
});
|
||||
|
||||
it("merges translation lyrics", () => {
|
||||
const lrc = "[00:12.50]Hello world";
|
||||
const tlyric = "[00:12.50]你好世界";
|
||||
const lines = parseLyrics(lrc, tlyric);
|
||||
expect(lines[0].text).toBe("Hello world");
|
||||
expect(lines[0].translation).toBe("你好世界");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user