Added tests for bindings

This commit is contained in:
Kylart 2020-04-15 02:05:17 +02:00
parent 3be7711f26
commit f592a55e21
5 changed files with 301 additions and 0 deletions

2
test/bindings/index.js Normal file
View File

@ -0,0 +1,2 @@
require('./nameParser/index.spec')()
require('./torrent/index.spec')()

View File

@ -0,0 +1,236 @@
[
{
"filename": "[HorribleSubs] Sakura Trick - 12[1080p].mkv",
"result": {
"anime_title": "Sakura Trick",
"episode_number": "12",
"file_extension": "mkv",
"file_name": "[HorribleSubs] Sakura Trick - 12[1080p]",
"release_group": "HorribleSubs",
"video_resolution": "1080p"
}
},
{
"filename": "[HorribleSubs] Sakura Trick - 12[720p].mkv",
"result": {
"anime_title": "Sakura Trick",
"episode_number": "12",
"file_extension": "mkv",
"file_name": "[HorribleSubs] Sakura Trick - 12[720p]",
"release_group": "HorribleSubs",
"video_resolution": "720p"
}
},
{
"filename": "[HorribleSubs] Sakura Trick - 12[480p].mkv",
"result": {
"anime_title": "Sakura Trick",
"episode_number": "12",
"file_extension": "mkv",
"file_name": "[HorribleSubs] Sakura Trick - 12[480p]",
"release_group": "HorribleSubs",
"video_resolution": "480p"
}
},
{
"filename": "[HorribleSubs] Sakura Trick - 11[1080p].mkv",
"result": {
"anime_title": "Sakura Trick",
"episode_number": "11",
"file_extension": "mkv",
"file_name": "[HorribleSubs] Sakura Trick - 11[1080p]",
"release_group": "HorribleSubs",
"video_resolution": "1080p"
}
},
{
"filename": "[HorribleSubs] Sakura Trick - 11[720p].mkv",
"result": {
"anime_title": "Sakura Trick",
"episode_number": "11",
"file_extension": "mkv",
"file_name": "[HorribleSubs] Sakura Trick - 11[720p]",
"release_group": "HorribleSubs",
"video_resolution": "720p"
}
},
{
"filename": "[HorribleSubs] Sakura Trick - 11[480p].mkv",
"result": {
"anime_title": "Sakura Trick",
"episode_number": "11",
"file_extension": "mkv",
"file_name": "[HorribleSubs] Sakura Trick - 11[480p]",
"release_group": "HorribleSubs",
"video_resolution": "480p"
}
},
{
"filename": "[HorribleSubs] Houkago Teibou Nisshi - 02[1080p].mkv",
"result": {
"anime_title": "Houkago Teibou Nisshi",
"episode_number": "02",
"file_extension": "mkv",
"file_name": "[HorribleSubs] Houkago Teibou Nisshi - 02[1080p]",
"release_group": "HorribleSubs",
"video_resolution": "1080p"
}
},
{
"filename": "[HorribleSubs] Houkago Teibou Nisshi - 02[720p].mkv",
"result": {
"anime_title": "Houkago Teibou Nisshi",
"episode_number": "02",
"file_extension": "mkv",
"file_name": "[HorribleSubs] Houkago Teibou Nisshi - 02[720p]",
"release_group": "HorribleSubs",
"video_resolution": "720p"
}
},
{
"filename": "[HorribleSubs] Houkago Teibou Nisshi - 02[360p].mkv",
"result": {
"anime_title": "Houkago Teibou Nisshi",
"episode_number": "02",
"file_extension": "mkv",
"file_name": "[HorribleSubs] Houkago Teibou Nisshi - 02[360p]",
"release_group": "HorribleSubs",
"video_resolution": "360p"
}
},
{
"filename": "[HorribleSubs] Black Clover - 130[1080p].mkv",
"result": {
"anime_title": "Black Clover",
"episode_number": "130",
"file_extension": "mkv",
"file_name": "[HorribleSubs] Black Clover - 130[1080p]",
"release_group": "HorribleSubs",
"video_resolution": "1080p"
}
},
{
"filename": "[HorribleSubs] Black Clover - 130[720p].mkv",
"result": {
"anime_title": "Black Clover",
"episode_number": "130",
"file_extension": "mkv",
"file_name": "[HorribleSubs] Black Clover - 130[720p]",
"release_group": "HorribleSubs",
"video_resolution": "720p"
}
},
{
"filename": "[HorribleSubs] Black Clover - 130[480p].mkv",
"result": {
"anime_title": "Black Clover",
"episode_number": "130",
"file_extension": "mkv",
"file_name": "[HorribleSubs] Black Clover - 130[480p]",
"release_group": "HorribleSubs",
"video_resolution": "480p"
}
},
{
"filename": "[Erai-raws] Shadowverse - 02[1080p][Multiple Subtitle].mkv",
"result": {
"anime_title": "Shadowverse",
"episode_number": "02",
"file_extension": "mkv",
"file_name": "[Erai-raws] Shadowverse - 02[1080p][Multiple Subtitle]",
"release_group": "Erai-raws",
"video_resolution": "1080p"
}
},
{
"filename": "[Erai-raws] Shadowverse - 02[720p][Multiple Subtitle].mkv",
"result": {
"anime_title": "Shadowverse",
"episode_number": "02",
"file_extension": "mkv",
"file_name": "[Erai-raws] Shadowverse - 02[720p][Multiple Subtitle]",
"release_group": "Erai-raws",
"video_resolution": "720p"
}
},
{
"filename": "[Erai-raws] Princess Connect! Re - Dive - 02[1080p][Multiple Subtitle].mkv",
"result": {
"anime_title": "Princess Connect! Re - Dive",
"episode_number": "02",
"file_extension": "mkv",
"file_name": "[Erai-raws] Princess Connect! Re - Dive - 02[1080p][Multiple Subtitle]",
"release_group": "Erai-raws",
"video_resolution": "1080p"
}
},
{
"filename": "[Erai-raws] Kitsutsuki Tanteidokoro - 01[1080p][Multiple Subtitle].mkv",
"result": {
"anime_title": "Kitsutsuki Tanteidokoro",
"episode_number": "01",
"file_extension": "mkv",
"file_name": "[Erai-raws] Kitsutsuki Tanteidokoro - 01[1080p][Multiple Subtitle]",
"release_group": "Erai-raws",
"video_resolution": "1080p"
}
},
{
"filename": "[Erai-raws] Fate Grand Order - Zettai Majuu Sensen Babylonia - 20[1080p][Multiple Subtitle].mkv",
"result": {
"anime_title": "Fate Grand Order - Zettai Majuu Sensen Babylonia",
"episode_number": "20",
"file_extension": "mkv",
"file_name": "[Erai-raws] Fate Grand Order - Zettai Majuu Sensen Babylonia - 20[1080p][Multiple Subtitle]",
"release_group": "Erai-raws",
"video_resolution": "1080p"
}
},
{
"filename": "[Erai-raws] 22 - 7 - 10[1080p][Multiple Subtitle].mkv",
"result": {
"anime_title": "22",
"episode_number": "7",
"episode_title": "10",
"file_extension": "mkv",
"file_name": "[Erai-raws] 22 - 7 - 10[1080p][Multiple Subtitle]",
"release_group": "Erai-raws",
"video_resolution": "1080p"
}
},
{
"filename": "[Erai-raws] Princess Connect! Re - Dive - 02[720p][Multiple Subtitle].mkv",
"result": {
"anime_title": "Princess Connect! Re - Dive",
"episode_number": "02",
"file_extension": "mkv",
"file_name": "[Erai-raws] Princess Connect! Re - Dive - 02[720p][Multiple Subtitle]",
"release_group": "Erai-raws",
"video_resolution": "720p"
}
},
{
"filename": "[Erai-raws] Fruits Basket 2nd Season - 02[1080p].mkv",
"result": {
"anime_season": "2",
"anime_title": "Fruits Basket",
"episode_number": "02",
"file_extension": "mkv",
"file_name": "[Erai-raws] Fruits Basket 2nd Season - 02[1080p]",
"release_group": "Erai-raws",
"video_resolution": "1080p"
}
},
{
"filename": "[Erai-raws] Fruits Basket 2nd Season - 02[720p].mkv",
"result": {
"anime_season": "2",
"anime_title": "Fruits Basket",
"episode_number": "02",
"file_extension": "mkv",
"file_name": "[Erai-raws] Fruits Basket 2nd Season - 02[720p]",
"release_group": "Erai-raws",
"video_resolution": "720p"
}
}
]

View File

@ -0,0 +1,33 @@
const chai = require('chai')
const should = chai.should()
const expect = chai.expect
module.exports = function () {
describe('Anitomy bindings', function () {
this.bindings = null
it('should successfullly import the bindings', function () {
try {
this.bindings = require('../../../bindings/build/Release/kawaparser.node')
} catch (e) {
should.fail('Could not import Anitomy bindings: ' + e.stack)
}
})
it('should be formatted properly', function () {
this.bindings.should.be.an('object')
this.bindings.should.include.keys('parseName')
this.bindings.parseName.should.be.a('function')
})
it('should be able to parse some filenames', function () {
const data = require('./data.json')
const parse = this.bindings.parseName
data.forEach(({ filename, result }) => {
expect(parse(filename)).to.eql(result)
})
})
})
}

View File

@ -0,0 +1,26 @@
const chai = require('chai')
const should = chai.should()
module.exports = function () {
describe('Libtorrent bindings', function () {
this.bindings = null
it('should successfullly import the bindings', function () {
try {
this.bindings = require('../../../bindings/build/Release/kawatorrent.node')
} catch (e) {
should.fail('Could not import Libtorrent bindings: ' + e.stack)
}
})
it('should be formatted properly', function () {
this.bindings.should.be.an('object')
this.bindings.should.include.keys('torrent')
this.bindings.torrent.should.be.a('object')
this.bindings.torrent.should.include.keys(['Client', 'version'])
this.bindings.torrent.version.should.be.a('string')
this.bindings.torrent.Client.should.be.a('function')
})
})
}

View File

@ -13,6 +13,10 @@
* - Webdriver.io: https://webdriver.io/docs/api/browser/waitUntil.html
*/
describe('KawaBinds main test routine', function () {
require('./bindings')
})
describe('KawAnime main test routine', function () {
this.timeout(30000)