2017-06-07 20:47:10 +00:00
|
|
|
/*jshint esversion: 6 */
|
2017-06-07 20:14:09 +00:00
|
|
|
var assert = require('assert');
|
2018-06-02 11:00:34 +00:00
|
|
|
var parser = require('../src/parser');
|
2017-06-07 20:14:09 +00:00
|
|
|
|
|
|
|
const TEXT = `
|
2017-06-10 20:23:12 +00:00
|
|
|
00:40 The Coders - Hello World
|
2017-06-07 20:14:09 +00:00
|
|
|
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
|
|
|
});
|
|
|
|
});
|