!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 

uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 

uid=33(www-data) gid=33(www-data) groups=33(www-data) 

Safe-mode: OFF (not secure)

/usr/local/lib/node_modules/strapi/node_modules/node-schedule/test/   drwxr-xr-x
Free 13.01 GB of 57.97 GB (22.44%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     schedule-cron-jobs.js (2.7 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
'use strict';

var sinon = require('sinon');
var main = require('../package.json').main;
var schedule = require('../' + main);

var clock;

module.exports = {
  ".scheduleJob(cron_expr, fn)": {
    setUp: function(cb) {
      clock = sinon.useFakeTimers();
      cb();
    },
    "Runs job every second": function(test) {
      test.expect(3);

      var timeout = 3 * 1000 + 150;

      var job = schedule.scheduleJob('* * * * * *', function() {
        test.ok(true);
      });

      setTimeout(function() {
        job.cancel();
        test.done();
      }, timeout);

      clock.tick(timeout);
    },
    "Runs job every minute": function(test) {
      test.expect(3);

      var timeout = 3 * 60 * 1000 + 150;

      var job = schedule.scheduleJob('0 * * * * *', function() {
        test.ok(true);
      });

      setTimeout(function() {
        job.cancel();
        test.done();
      }, timeout);

      clock.tick(timeout);
    },
    "Runs job every hour": function(test) {
      test.expect(3);

      var timeout = 3 * 60 * 60 * 1000 + 150;

      var job = schedule.scheduleJob('0 0 * * * *', function() {
        test.ok(true);
      });

      setTimeout(function() {
        job.cancel();
        test.done();
      }, timeout);

      clock.tick(timeout);
    },
    "Runs job every day": function(test) {
      test.expect(3);

      var timeout = 3 * 24 * 60 * 60 * 1000 + 150;

      var job = schedule.scheduleJob('0 0 0 * * *', function() {
        test.ok(true);
      });

      setTimeout(function() {
        job.cancel();
        test.done();
      }, timeout);

      clock.tick(timeout);
    },
    "Runs job every week": function(test) {
      test.expect(3);

      var timeout = 3 * 7 * 24 * 60 * 60 * 1000 + 150;

      var job = schedule.scheduleJob('0 0 0 * * 1', function() {
        test.ok(true);
      });

      setTimeout(function() {
        job.cancel();
        test.done();
      }, timeout);

      clock.tick(timeout);
    },
    "Runs job every month": function(test) {
      test.expect(48);

      var timeout = 4 * 365.25 * 24 * 60 * 60 * 1000 + 150;

      var job = schedule.scheduleJob('0 0 0 1 * *', function() {
        test.ok(true);
      });

      setTimeout(function() {
        job.cancel();
        test.done();
      }, timeout);

      clock.tick(timeout);

    },
    "Runs job every year": function(test) {
      test.expect(4);

      var timeout = 4 * 365.25 * 24 * 60 * 60 * 1000 + 150;

      var job = schedule.scheduleJob('0 0 0 1 1 *', function() {
        test.ok(true);
      });

      setTimeout(function() {
        job.cancel();
        test.done();
      }, timeout);

      clock.tick(timeout);
    },
    tearDown: function(cb) {
      clock.restore();
      cb();
    }
  }
};

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0195 ]--