🏡 index : github.com/captn3m0/youtube-cue.git

author Nemo <commits@captnemo.in> 2021-07-21 12:08:04.0 +05:30:00
committer Nemo <commits@captnemo.in> 2021-07-21 12:10:28.0 +05:30:00
commit
3fdb7739ff10e4b9b7ae3a8cdd7f4f560862d5ab [patch]
tree
82f80785d39b6b25b3c919b8e1781439fa2eaca1
parent
ce845195cf845f64477ea73783b26e39cd50388d
download
3fdb7739ff10e4b9b7ae3a8cdd7f4f560862d5ab.tar.gz

Add testcase for parsing duration

Ref #68

Diff

 test/parser_test.js | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/test/parser_test.js b/test/parser_test.js
index b4c3c12..67ef90f 100644
--- a/test/parser_test.js
+++ a/test/parser_test.js
@@ -76,6 +76,20 @@
      })
  });

  it("should parse durations when given", function() {
    let result = parse(`1. Artist - Title - 6:19
2. Another Artist - Another Title - 6:59
3. Yet Another Artist - Yet another title - 5:12`)
    assert.deepEqual(result[0], {
        artist: "Artist",
        title: "Title",
        track: 1,
        start: { ts: "00:00:00", hh: 0, mm: 0, ss: 0, calc: 0 },
        end: { ts: "00:06:19", hh: 0, mm: 6, ss: 19, calc: 379 },
        _: { left_text: "Artist - Title", right_text: "" },
      })
  });

  it("should parse taylor swift", function() {
    let result = parse(`0:00 the 1
    3:29 cardigan