import assert from 'node:assert/strict' import { readFileSync } from 'node:fs' import test from 'node:test' import { fileURLToPath } from 'node:url' const auditAssetList = readFileSync( fileURLToPath(new URL('../src/components/audit/AuditAssetList.vue', import.meta.url)), 'utf8' ) const auditViewStyles = readFileSync( fileURLToPath(new URL('../src/assets/styles/views/audit-view.css', import.meta.url)), 'utf8' ) const digitalEmployeeList = readFileSync( fileURLToPath(new URL('../src/components/audit/DigitalEmployeeListPanel.vue', import.meta.url)), 'utf8' ) const digitalEmployeesView = readFileSync( fileURLToPath(new URL('../src/views/DigitalEmployeesView.vue', import.meta.url)), 'utf8' ) const digitalEmployeesViewModel = readFileSync( fileURLToPath(new URL('../src/views/scripts/digitalEmployeesViewModel.js', import.meta.url)), 'utf8' ) const digitalEmployeeStyles = readFileSync( fileURLToPath(new URL('../src/assets/styles/views/digital-employees-view.css', import.meta.url)), 'utf8' ) test('audit rule name column stays left aligned', () => { assert.match(auditAssetList, //) assert.match(auditViewStyles, /\.audit-asset-table th:first-child,[\s\S]*?text-align: left;/) assert.match(auditViewStyles, /\.skill-name-cell \{[\s\S]*?text-align: left;/) }) test('digital employee skill name keeps text avatar prefix', () => { assert.match(digitalEmployeeList, /class="digital-skill-cell"/) assert.match(digitalEmployeeList, /class="digital-skill-avatar"/) assert.match(digitalEmployeeStyles, /\.digital-skill-cell \{[\s\S]*?text-align: left;/) assert.match(digitalEmployeeStyles, /\.digital-skill-cell \{[\s\S]*?grid-template-columns: 38px minmax\(0, 1fr\);/) assert.match(digitalEmployeeStyles, /\.digital-skill-avatar \{[\s\S]*?width: 38px;[\s\S]*?border-radius: 11px;/) assert.match(digitalEmployeeStyles, /\.digital-skill-avatar\.blue \{[\s\S]*?linear-gradient\(135deg, #3b82f6, #2563eb\);/) }) test('digital employee skill list uses real pagination', () => { assert.match(digitalEmployeeList, /:show-pagination="!loading && !errorMessage && visibleEmployees\.length > 0"/) assert.match(digitalEmployeeList, /:show-page-size="true"/) assert.match(digitalEmployeeList, /:page-size-options="pageSizeOptions"/) assert.match(digitalEmployeeList, /@page-size-change="changePageSize"/) assert.match(digitalEmployeeList, /v-for="employee in pagedEmployees"/) assert.match(digitalEmployeeList, /const pageSize = ref\(10\)/) assert.match(digitalEmployeeList, /label: '10 条\/页', value: 10/) assert.match(digitalEmployeeList, /label: '20 条\/页', value: 20/) assert.match(digitalEmployeeList, /label: '50 条\/页', value: 50/) assert.match(digitalEmployeeList, /每页 \$\{pageSize\.value\} 条/) assert.match(digitalEmployeeList, /function changePageSize\(size\) \{[\s\S]*?currentPage\.value = 1/) }) test('digital employee skill type filter is wired through list and model', () => { assert.match(digitalEmployeeList, /id="skillCategory"/) assert.match(digitalEmployeeList, /:label="selectedSkillCategoryLabel"/) assert.match(digitalEmployeeList, /:options="skillCategoryOptions"/) assert.match(digitalEmployeeList, /:selected-value="selectedSkillCategory"/) assert.match(digitalEmployeeList, /selectFilter\('skillCategory', \$event\)/) assert.match(digitalEmployeeList, /props\.selectedSkillCategory/) assert.match(digitalEmployeesView, /:selected-skill-category="selectedSkillCategory"/) assert.match(digitalEmployeesView, /:skill-category-options="skillCategoryOptions"/) assert.match(digitalEmployeesView, /selectedSkillCategory: selectedSkillCategory\.value/) assert.match(digitalEmployeesView, /if \(type === 'skillCategory'\)[\s\S]*?selectedSkillCategory\.value = value/) assert.match(digitalEmployeesView, /selectedSkillCategory\.value = ''/) assert.match(digitalEmployeesViewModel, /selectedSkillCategory = normalizeText\(filters\.selectedSkillCategory\)/) assert.match(digitalEmployeesViewModel, /hasSkillCategory/) assert.match(digitalEmployeesViewModel, /normalizeText\(item\.skillCategory\) !== selectedSkillCategory/) })