mirror of
https://github.com/gabehf/Tdarr_Plugins.git
synced 2026-03-14 01:36:08 -07:00
Add Tdarr_Plugin_A47j_FFMPEG_NVENC_HEVC_Video_Only test
This commit is contained in:
parent
7f51f3e057
commit
a9408f921e
4 changed files with 119 additions and 6 deletions
|
|
@ -1,10 +1,9 @@
|
|||
const path = require('path');
|
||||
const chai = require('chai');
|
||||
const _ = require('lodash');
|
||||
const importFresh = require('import-fresh');
|
||||
|
||||
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 {
|
||||
|
|
@ -15,6 +14,9 @@ const run = async (tests) => {
|
|||
|
||||
let testOutput;
|
||||
let errorEncountered = false;
|
||||
// eslint-disable-next-line import/no-dynamic-require
|
||||
const { plugin } = importFresh(`../../Community/${scriptName}`);
|
||||
|
||||
try {
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
testOutput = await plugin(
|
||||
|
|
@ -24,13 +26,13 @@ const run = async (tests) => {
|
|||
_.cloneDeep(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) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(errorEncountered);
|
||||
chai.assert.deepEqual(errorEncountered.message, test.output);
|
||||
} else {
|
||||
throw new Error('Expected plugin error but none was thrown!');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue