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

author Nemo <me@captnemo.in> 2017-06-08 2:17:10.0 +05:30:00
committer Nemo <me@captnemo.in> 2017-06-08 2:17:10.0 +05:30:00
commit
9035cbefe2c9657e76dda13ac6d61d06ce26032e [patch]
tree
f4a21da22d4bfa321e7b321611a00d2ebff28ad4
parent
0c03879b7d0131f76500a471d549f68eed2f3bf4
download
9035cbefe2c9657e76dda13ac6d61d06ce26032e.tar.gz

Adds artist names tests



Diff

 parser.js           |  1 +
 test/parser_test.js |  9 +++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/parser.js b/parser.js
index 4ee1ee9..b35d048 100644
--- a/parser.js
+++ a/parser.js
@@ -1,3 +1,4 @@
/*jshint esversion: 6 */
const TS_REGEX = /((\d{1,2}:)?\d{1,2}:\d{1,2})/;

var filterTimestamp = function(line) {
diff --git a/test/parser_test.js b/test/parser_test.js
index 9cce8b9..a57cffb 100644
--- a/test/parser_test.js
+++ a/test/parser_test.js
@@ -1,3 +1,4 @@
/*jshint esversion: 6 */
var assert = require('assert');
var parser = require('../parser');

@@ -8,11 +9,17 @@
1:23:11 Not the last song
`;

const TEXT_WITH_ARTIST = '12:23 Rolling Stones - Hello World';

describe('Parser', function() {
  describe('parser', function() {
    it('should find all timestamps', function() {
      console.log(parser.parse(TEXT));
      assert.equal(parser.parse(TEXT).length, 3);
    });

    it('should find artist names', function() {
      let result = parser.parse(TEXT_WITH_ARTIST);
      assert.equal(result[0].artist, 'Rolling Stones');
    });
  });
});