mirror of
https://github.com/gabehf/Tdarr_Plugins.git
synced 2026-03-14 01:36:08 -07:00
useCloneDeep
This commit is contained in:
parent
3032997079
commit
2dc25ebf8c
6 changed files with 23 additions and 23 deletions
3
package-lock.json
generated
3
package-lock.json
generated
|
|
@ -1178,8 +1178,7 @@
|
||||||
"lodash": {
|
"lodash": {
|
||||||
"version": "4.17.21",
|
"version": "4.17.21",
|
||||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
|
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
|
||||||
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
|
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"loupe": {
|
"loupe": {
|
||||||
"version": "2.3.4",
|
"version": "2.3.4",
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,8 @@
|
||||||
"description": "Tdar Plugins Repo",
|
"description": "Tdar Plugins Repo",
|
||||||
"main": "",
|
"main": "",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"chalk": "^4.1.2"
|
"chalk": "^4.1.2",
|
||||||
|
"lodash": "^4.17.21"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"chai": "^4.3.6",
|
"chai": "^4.3.6",
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,11 @@
|
||||||
/* eslint max-len: 0 */
|
/* eslint max-len: 0 */
|
||||||
|
const _ = require('lodash');
|
||||||
const run = require('../helpers/run');
|
const run = require('../helpers/run');
|
||||||
|
|
||||||
const tests = [
|
const tests = [
|
||||||
{
|
{
|
||||||
input: {
|
input: {
|
||||||
file: require('../sampleData/media/sampleH264_1.json'),
|
file: _.cloneDeep(require('../sampleData/media/sampleH264_1.json')),
|
||||||
librarySettings: {},
|
librarySettings: {},
|
||||||
inputs: {},
|
inputs: {},
|
||||||
otherArguments: {},
|
otherArguments: {},
|
||||||
|
|
@ -21,7 +22,7 @@ const tests = [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
input: {
|
input: {
|
||||||
file: require('../sampleData/media/sampleH265_1.json'),
|
file: _.cloneDeep(require('../sampleData/media/sampleH265_1.json')),
|
||||||
librarySettings: {},
|
librarySettings: {},
|
||||||
inputs: {},
|
inputs: {},
|
||||||
otherArguments: {},
|
otherArguments: {},
|
||||||
|
|
@ -38,11 +39,11 @@ const tests = [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
input: {
|
input: {
|
||||||
file: () => {
|
file: (() => {
|
||||||
const file = require('../sampleData/media/sampleH264_1.json');
|
const file = _.cloneDeep(require('../sampleData/media/sampleH264_1.json'));
|
||||||
file.meta.Title = undefined;
|
file.meta.Title = undefined;
|
||||||
return file;
|
return file;
|
||||||
},
|
})(),
|
||||||
librarySettings: {},
|
librarySettings: {},
|
||||||
inputs: {},
|
inputs: {},
|
||||||
otherArguments: {},
|
otherArguments: {},
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,11 @@
|
||||||
/* eslint max-len: 0 */
|
/* eslint max-len: 0 */
|
||||||
|
const _ = require('lodash');
|
||||||
const run = require('../helpers/run');
|
const run = require('../helpers/run');
|
||||||
|
|
||||||
const tests = [
|
const tests = [
|
||||||
{
|
{
|
||||||
input: {
|
input: {
|
||||||
file: require('../sampleData/media/sampleH264_1.json'),
|
file: _.cloneDeep(require('../sampleData/media/sampleH264_1.json')),
|
||||||
librarySettings: {},
|
librarySettings: {},
|
||||||
inputs: {},
|
inputs: {},
|
||||||
otherArguments: {},
|
otherArguments: {},
|
||||||
|
|
@ -21,7 +22,7 @@ const tests = [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
input: {
|
input: {
|
||||||
file: require('../sampleData/media/sampleH265_1.json'),
|
file: _.cloneDeep(require('../sampleData/media/sampleH265_1.json')),
|
||||||
librarySettings: {},
|
librarySettings: {},
|
||||||
inputs: {},
|
inputs: {},
|
||||||
otherArguments: {},
|
otherArguments: {},
|
||||||
|
|
@ -38,11 +39,11 @@ const tests = [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
input: {
|
input: {
|
||||||
file: () => {
|
file: (() => {
|
||||||
const file = require('../sampleData/media/sampleH264_1.json');
|
const file = _.cloneDeep(require('../sampleData/media/sampleH264_1.json'));
|
||||||
file.meta.Title = undefined;
|
file.meta.Title = undefined;
|
||||||
return file;
|
return file;
|
||||||
},
|
})(),
|
||||||
librarySettings: {},
|
librarySettings: {},
|
||||||
inputs: {},
|
inputs: {},
|
||||||
otherArguments: {},
|
otherArguments: {},
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
/* eslint max-len: 0 */
|
/* eslint max-len: 0 */
|
||||||
|
const _ = require('lodash');
|
||||||
const run = require('../helpers/run');
|
const run = require('../helpers/run');
|
||||||
|
|
||||||
const tests = [
|
const tests = [
|
||||||
|
|
@ -30,7 +31,7 @@ const tests = [
|
||||||
},
|
},
|
||||||
otherArguments: {
|
otherArguments: {
|
||||||
originalLibraryFile: (() => {
|
originalLibraryFile: (() => {
|
||||||
const file = JSON.parse(JSON.stringify(require('../sampleData/media/sampleH264_1.json')));
|
const file = _.cloneDeep(require('../sampleData/media/sampleH264_1.json'));
|
||||||
file.file_size = 3;
|
file.file_size = 3;
|
||||||
return file;
|
return file;
|
||||||
})(),
|
})(),
|
||||||
|
|
@ -51,7 +52,7 @@ const tests = [
|
||||||
},
|
},
|
||||||
otherArguments: {
|
otherArguments: {
|
||||||
originalLibraryFile: (() => {
|
originalLibraryFile: (() => {
|
||||||
const file = JSON.parse(JSON.stringify(require('../sampleData/media/sampleH264_1.json')));
|
const file = _.cloneDeep(require('../sampleData/media/sampleH264_1.json'));
|
||||||
file.file_size = 0.1;
|
file.file_size = 0.1;
|
||||||
return file;
|
return file;
|
||||||
})(),
|
})(),
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const chai = require('chai');
|
const chai = require('chai');
|
||||||
|
const _ = require('lodash');
|
||||||
|
|
||||||
const scriptName = path.basename(process.mainModule.filename);
|
const scriptName = path.basename(process.mainModule.filename);
|
||||||
// eslint-disable-next-line import/no-dynamic-require
|
// eslint-disable-next-line import/no-dynamic-require
|
||||||
|
|
@ -11,20 +12,16 @@ const run = async (tests) => {
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
console.log(`${scriptName}: test ${i}`);
|
console.log(`${scriptName}: test ${i}`);
|
||||||
const test = tests[i];
|
const test = tests[i];
|
||||||
let { file } = test.input;
|
|
||||||
if (typeof test.input.file === 'function') {
|
|
||||||
file = test.input.file();
|
|
||||||
}
|
|
||||||
|
|
||||||
let testOutput;
|
let testOutput;
|
||||||
let errorEncountered = false;
|
let errorEncountered = false;
|
||||||
try {
|
try {
|
||||||
// eslint-disable-next-line no-await-in-loop
|
// eslint-disable-next-line no-await-in-loop
|
||||||
testOutput = await plugin(
|
testOutput = await plugin(
|
||||||
file,
|
_.cloneDeep(test.input.file),
|
||||||
test.input.librarySettings,
|
_.cloneDeep(test.input.librarySettings),
|
||||||
test.input.inputs,
|
_.cloneDeep(test.input.inputs),
|
||||||
test.input.otherArguments,
|
_.cloneDeep(test.input.otherArguments),
|
||||||
);
|
);
|
||||||
} catch (err1) {
|
} catch (err1) {
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue