feat: log staff sign-in and sign-out and force logout at a set time
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import { describe, it } from 'node:test';
|
||||
import { loggedInAfterCutoff, tehranCutoff } from '../src/attendance/attendance-time';
|
||||
|
||||
describe('ساعت خروج تهران', () => {
|
||||
it('ورود قبل از ۱۸ خروج اجباری میخواهد و ورود بعد از آن نه', () => {
|
||||
const morning = new Date('2026-10-19T05:30:00.000Z'); // ۰۹:۰۰ تهران
|
||||
const evening = new Date('2026-10-19T15:30:00.000Z'); // ۱۹:۰۰ تهران
|
||||
const cutoff = tehranCutoff(evening, '18:00');
|
||||
assert.ok(cutoff);
|
||||
assert.equal(morning.getTime() < cutoff.getTime(), true);
|
||||
assert.equal(evening.getTime() >= cutoff.getTime(), true);
|
||||
assert.equal(loggedInAfterCutoff(morning, '18:00'), false);
|
||||
assert.equal(loggedInAfterCutoff(evening, '18:00'), true);
|
||||
assert.equal(loggedInAfterCutoff(evening, null), false);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user