mirror of
https://github.com/gabehf/Tdarr_Plugins.git
synced 2026-03-15 18:25:54 -07:00
Add Tdarr_Plugin_a9he_New_file_size_check test
This commit is contained in:
parent
7dcee9b1ae
commit
3032997079
3 changed files with 93 additions and 9 deletions
|
|
@ -15,14 +15,32 @@ const run = async (tests) => {
|
|||
if (typeof test.input.file === 'function') {
|
||||
file = test.input.file();
|
||||
}
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
const testOutput = await plugin(
|
||||
file,
|
||||
test.input.librarySettings,
|
||||
test.input.inputs,
|
||||
test.input.otherArguments,
|
||||
);
|
||||
chai.assert.deepEqual(testOutput, test.output);
|
||||
|
||||
let testOutput;
|
||||
let errorEncountered = false;
|
||||
try {
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
testOutput = await plugin(
|
||||
file,
|
||||
test.input.librarySettings,
|
||||
test.input.inputs,
|
||||
test.input.otherArguments,
|
||||
);
|
||||
} catch (err1) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(err1);
|
||||
errorEncountered = err1;
|
||||
}
|
||||
|
||||
if (test.error && test.error.shouldThrow) {
|
||||
if (errorEncountered !== false) {
|
||||
chai.assert.deepEqual(errorEncountered.message, test.output);
|
||||
} else {
|
||||
throw new Error('Expected plugin error but none was thrown!');
|
||||
}
|
||||
} else {
|
||||
chai.assert.deepEqual(testOutput, test.output);
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
// eslint-disable-next-line no-console
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue