youtube-cue/test/parser_test.js

26 lines
623 B
JavaScript
Raw Normal View History

2017-06-07 20:47:10 +00:00
/*jshint esversion: 6 */
2017-06-07 20:14:09 +00:00
var assert = require('assert');
var parser = require('../parser');
const TEXT = `
00:40 Hello World
12:23 This is not the end
Something else in the middle
1:23:11 Not the last song
`;
2017-06-07 20:47:10 +00:00
const TEXT_WITH_ARTIST = '12:23 Rolling Stones - Hello World';
2017-06-07 20:14:09 +00:00
describe('Parser', function() {
describe('parser', function() {
it('should find all timestamps', function() {
assert.equal(parser.parse(TEXT).length, 3);
});
2017-06-07 20:47:10 +00:00
it('should find artist names', function() {
let result = parser.parse(TEXT_WITH_ARTIST);
assert.equal(result[0].artist, 'Rolling Stones');
});
2017-06-07 20:14:09 +00:00
});
});