import assert from 'node:assert/strict' import { readFileSync } from 'node:fs' import test from 'node:test' import { fileURLToPath } from 'node:url' import { formatEmployeeHistoryTime } from '../src/views/scripts/employeeManagementModel.js' const employeeViewTemplate = readFileSync( fileURLToPath(new URL('../src/views/EmployeeManagementView.vue', import.meta.url)), 'utf8' ) const employeeViewStyles = readFileSync( fileURLToPath( new URL('../src/assets/styles/views/employee-management-view.css', import.meta.url) ), 'utf8' ) test('employee history time uses fixed-width date and minute format', () => { assert.equal(formatEmployeeHistoryTime('2026年5月6日10时4分'), '2026-05-06 10:04') assert.equal(formatEmployeeHistoryTime('2026-05-06T10:04:33+08:00'), '2026-05-06 10:04') assert.equal(formatEmployeeHistoryTime('2026-05-06 10:04'), '2026-05-06 10:04') }) test('employee history row keeps owner and time in aligned grid columns', () => { assert.match(employeeViewTemplate, /class="history-row-owner"/) assert.match(employeeViewTemplate, /class="history-row-time"/) assert.doesNotMatch(employeeViewTemplate, /class="history-row-meta"/) assert.match(employeeViewStyles, /\.history-row\s*\{[^}]*display:\s*grid/s) assert.match( employeeViewStyles, /\.history-row\s*\{[^}]*grid-template-columns:\s*minmax\(0,\s*1fr\)\s*128px\s*112px/s ) assert.match(employeeViewStyles, /\.history-row-time\s*\{[^}]*font-variant-numeric:\s*tabular-nums/s) })