a71f801c3f
- Prisma schema: User, Session, RepoConfig, Preview, Job, WebhookToken, NoConfigComment, AdminSettings - Backend: auth (login/logout/me/first-user setup), webhook handler with HMAC verification, EC2 service, SSH service, deploy pipeline, job queue worker, cron workers - Frontend: Login with first-user detection, Dashboard, PreviewDetail with live log streaming, Settings, Repos config, Admin panel, SetupWizard, Privacy page - Docker Compose and Dockerfile for self-hosted deployment - Uses bcryptjs for Node 24 compatibility Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
47 lines
1.4 KiB
JavaScript
47 lines
1.4 KiB
JavaScript
const { assert } = require('chai');
|
|
const BackgroundScheduledTask = require('../src/background-scheduled-task');
|
|
|
|
describe('BackgroundScheduledTask', () => {
|
|
it('should start a task by default', (done) => {
|
|
let task = new BackgroundScheduledTask('* * * * * *', './test/assets/dummy-task.js');
|
|
task.on('task-done', (result) => {
|
|
assert.equal('dummy task', result);
|
|
task.stop();
|
|
done();
|
|
});
|
|
});
|
|
it('should create a task stoped', () => {
|
|
let task = new BackgroundScheduledTask('* * * * * *', './test/assets/dummy-task.js', {
|
|
scheduled: false
|
|
});
|
|
|
|
assert.isUndefined(task.pid());
|
|
});
|
|
|
|
it('should start a task', (done) => {
|
|
let task = new BackgroundScheduledTask('* * * * * *', './test/assets/dummy-task.js', {
|
|
scheduled: false
|
|
});
|
|
|
|
assert.isUndefined(task.pid());
|
|
|
|
task.on('task-done', (result) => {
|
|
assert.equal('dummy task', result);
|
|
task.stop();
|
|
done();
|
|
});
|
|
|
|
task.start();
|
|
assert.isNotNull(task.pid());
|
|
});
|
|
|
|
it('should stop a task', () => {
|
|
let task = new BackgroundScheduledTask('* * * * * *', './test/assets/dummy-task.js', {
|
|
scheduled: true
|
|
});
|
|
assert.isNotNull(task.pid());
|
|
assert.isTrue(task.isRunning());
|
|
task.stop();
|
|
assert.isFalse(task.isRunning());
|
|
});
|
|
}); |