mirror of
https://github.com/gabehf/Tdarr_Plugins.git
synced 2026-03-17 11:16:26 -07:00
Add tests, fix errors
This commit is contained in:
parent
1b16da3009
commit
7c56b3a517
2 changed files with 67 additions and 4 deletions
|
|
@ -12,9 +12,9 @@ const details = () => ({
|
||||||
{
|
{
|
||||||
name: 'minModifiedDaysOld',
|
name: 'minModifiedDaysOld',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
defaultValue: '30',
|
defaultValue: 30,
|
||||||
inputUI: {
|
inputUI: {
|
||||||
type: 'number',
|
type: 'text',
|
||||||
},
|
},
|
||||||
tooltip: `Enter minimum number of days since modified since now file must be.
|
tooltip: `Enter minimum number of days since modified since now file must be.
|
||||||
|
|
||||||
|
|
@ -43,12 +43,12 @@ const plugin = (file, librarySettings, inputs, otherArguments) => {
|
||||||
// response.infoLog += ` Age ${age} Require Min Age: ${reqage}`;
|
// response.infoLog += ` Age ${age} Require Min Age: ${reqage}`;
|
||||||
if (reqage < age)
|
if (reqage < age)
|
||||||
{
|
{
|
||||||
// response.infoLog += " Old enough, lets do this!";
|
response.infoLog += "File modified date old enough. Moving to next plugin.";
|
||||||
response.processFile = true;
|
response.processFile = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
response.infoLog += " Skipping, file modified date not old enough";
|
response.infoLog += "Skipping, file modified date not old enough";
|
||||||
response.processFile = false;
|
response.processFile = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
63
tests/Community/Tdarr_Plugin_tsld_filter_modified_date.js
Normal file
63
tests/Community/Tdarr_Plugin_tsld_filter_modified_date.js
Normal file
|
|
@ -0,0 +1,63 @@
|
||||||
|
/* eslint max-len: 0 */
|
||||||
|
const run = require('../helpers/run');
|
||||||
|
|
||||||
|
const tests = [
|
||||||
|
{
|
||||||
|
input: {
|
||||||
|
file: require('../sampleData/media/sampleH264_2.json'),
|
||||||
|
librarySettings: {},
|
||||||
|
inputs: {
|
||||||
|
minModifiedDaysOld: 1
|
||||||
|
},
|
||||||
|
otherArguments: {},
|
||||||
|
},
|
||||||
|
output: {
|
||||||
|
processFile: true,
|
||||||
|
infoLog: 'File modified date old enough. Moving to next plugin.',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
input: {
|
||||||
|
file: require('../sampleData/media/sampleH264_1.json'),
|
||||||
|
librarySettings: {},
|
||||||
|
inputs: {
|
||||||
|
minModifiedDaysOld: 9999
|
||||||
|
},
|
||||||
|
otherArguments: {},
|
||||||
|
},
|
||||||
|
output: {
|
||||||
|
processFile: false,
|
||||||
|
infoLog: 'Skipping, file modified date not old enough',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
input: {
|
||||||
|
file: require('../sampleData/media/sampleH264_1.json'),
|
||||||
|
librarySettings: {},
|
||||||
|
inputs: {
|
||||||
|
minModifiedDaysOld: 1
|
||||||
|
},
|
||||||
|
otherArguments: {},
|
||||||
|
},
|
||||||
|
output: {
|
||||||
|
processFile: true,
|
||||||
|
infoLog: 'File modified date old enough. Moving to next plugin.',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
input: {
|
||||||
|
file: require('../sampleData/media/sampleH264_1.json'),
|
||||||
|
librarySettings: {},
|
||||||
|
inputs: {
|
||||||
|
minModifiedDaysOld: 9999
|
||||||
|
},
|
||||||
|
otherArguments: {},
|
||||||
|
},
|
||||||
|
output: {
|
||||||
|
processFile: false,
|
||||||
|
infoLog: 'Skipping, file modified date not old enough',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
run(tests);
|
||||||
Loading…
Add table
Add a link
Reference in a new issue