mirror of
https://github.com/gabehf/Tdarr_Plugins.git
synced 2026-03-14 01:36:08 -07:00
Add new tests
This commit is contained in:
parent
e194e6d35c
commit
fa2b0abd92
9 changed files with 1011 additions and 2 deletions
30
tests/helpers/run.js
Normal file
30
tests/helpers/run.js
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
const path = require('path');
|
||||
const chai = require('chai');
|
||||
|
||||
const scriptName = path.basename(process.mainModule.filename);
|
||||
// eslint-disable-next-line import/no-dynamic-require
|
||||
const { plugin } = require(`../../Community/${scriptName}`);
|
||||
|
||||
const run = async (tests) => {
|
||||
try {
|
||||
for (let i = 0; i < tests.length; i += 1) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`${scriptName}: test ${i}`);
|
||||
const test = tests[i];
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
const testOutput = await plugin(
|
||||
test.input.file,
|
||||
test.input.librarySettings,
|
||||
test.input.inputs,
|
||||
test.input.otherArguments,
|
||||
);
|
||||
chai.assert.deepEqual(testOutput, test.output);
|
||||
}
|
||||
} catch (err) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(err);
|
||||
process.exit(1);
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = run;
|
||||
Loading…
Add table
Add a link
Reference in a new issue