Skip to content

Commit

Permalink
Added Tests for Episoder #190
Browse files Browse the repository at this point in the history
  • Loading branch information
hoffi committed Feb 19, 2015
1 parent ff03244 commit ac1d8d5
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
44 changes: 44 additions & 0 deletions spec/lib/episoder.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
var assert = require('assert');
var episoder = require('../../lib/utils/episoder');

describe('Episoder', function () {
it('should detect data completely from filename', function () {
var filenames = [
'Community S01E04',
'community s01e04',
'Community 1x04',
'Community 1-04',
'Community Season 1 Episode 4',
'Community Season 01 Episode 04',
'Community 104.mp4'
]

for (var i = 0; i < filenames.length; i++) {
var result = episoder.parseFilename(filenames[i]);

assert.equal(result.show, 'Community');
assert.equal(result.season, 1);
assert.equal(result.episode, 4);
}
});

it('should use the season option', function () {
var result = episoder.parseFilename('Community S01E04', { season: 6 });
assert.equal(result.season, 6);
});

it('should use the episode option', function () {
var result = episoder.parseFilename('Community S01E04', { episode: 16 });
assert.equal(result.episode, 16);
});

it('should use the show option', function () {
var result = episoder.parseFilename('Community S01E04', { show: 'TEST' });
assert.equal(result.show, 'Test');
});

it('should use the offset option', function () {
var result = episoder.parseFilename('Test S01E04', { offset: 2 });
assert.equal(result.episode, 6);
});
});
2 changes: 2 additions & 0 deletions spec/lib/title-cleaner.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ var title_cleaner = require('../../lib/utils/title-cleaner');
describe('TitleCleaner', function () {
it('should clean titles correctly', function () {
var corrupt_titles = [
'',
'A.Better.Life.LIMITED.DVDRip.XviD-TWiZTED',
'Aladdin[1992]DvDrip[Eng]-Stealthmaster',
'Austin Powers International Man of Mystery 1997.720p.x264.BRRip.GokU61',
Expand All @@ -12,6 +13,7 @@ describe('TitleCleaner', function () {
'Fight.Club.iMMORTALS.(1999).xvid-R5.torrent'
]
var cleaned_titles = [
'', // Empty titles should not throw an error
'A Better Life LIMITED',
'Aladdin',
'Austin Powers International Man of Mystery GokU61',
Expand Down

0 comments on commit ac1d8d5

Please sign in to comment.