2026-09-03 17:57:27 +09:30
|
|
|
import { readFile } from 'node:fs/promises'
|
|
|
|
|
import test from 'node:test'
|
|
|
|
|
import assert from 'node:assert/strict'
|
|
|
|
|
|
|
|
|
|
test('prototype interactions expose stable test ids', async () => {
|
|
|
|
|
const source = await readFile(new URL('../src/App.vue', import.meta.url), 'utf8')
|
|
|
|
|
const required = [
|
|
|
|
|
'admin-input-account',
|
|
|
|
|
'admin-input-password',
|
|
|
|
|
'admin-btn-login',
|
|
|
|
|
'admin-menu-tokens',
|
2026-09-15 12:05:26 +09:30
|
|
|
'admin-menu-clients',
|
2026-09-03 17:57:27 +09:30
|
|
|
'admin-menu-tools',
|
|
|
|
|
'admin-menu-scopes',
|
|
|
|
|
'admin-menu-audit',
|
|
|
|
|
'admin-input-user-search',
|
|
|
|
|
'admin-btn-issue-token',
|
2026-09-15 12:05:26 +09:30
|
|
|
'admin-btn-new-client',
|
|
|
|
|
'admin-table-clients',
|
|
|
|
|
'admin-issued-client-key',
|
2026-09-03 17:57:27 +09:30
|
|
|
'admin-table-tools',
|
2026-09-16 09:52:19 +08:00
|
|
|
'admin-tool-pager',
|
2026-09-03 17:57:27 +09:30
|
|
|
'admin-btn-new-scope',
|
|
|
|
|
'admin-table-scopes',
|
|
|
|
|
'admin-table-audit',
|
|
|
|
|
'admin-btn-logout'
|
|
|
|
|
]
|
|
|
|
|
for (const testId of required) {
|
|
|
|
|
assert.match(source, new RegExp(`data-testid=["']${testId}["']`), testId)
|
|
|
|
|
}
|
|
|
|
|
})
|
2026-09-23 13:03:16 +08:00
|
|
|
|
|
|
|
|
test('multi-tab navigation exposes tab bar and close controls', async () => {
|
|
|
|
|
const source = await readFile(new URL('../src/App.vue', import.meta.url), 'utf8')
|
|
|
|
|
assert.match(source, /data-testid=["']admin-tabbar["']/, 'admin-tabbar')
|
|
|
|
|
assert.match(source, /admin-tab-\$\{tab\.id\}/, 'admin-tab-*')
|
|
|
|
|
assert.match(source, /admin-tab-close-\$\{tab\.id\}/, 'admin-tab-close-*')
|
|
|
|
|
assert.match(source, /openTabs\.includes\('tokens'\)/, 'tokens panel gated by openTabs')
|
|
|
|
|
assert.match(source, /openTabs\.includes\('clients'\)/, 'clients panel gated by openTabs')
|
|
|
|
|
assert.match(source, /openTabs\.includes\('tools'\)/, 'tools panel gated by openTabs')
|
|
|
|
|
assert.match(source, /openTabs\.includes\('scopes'\)/, 'scopes panel gated by openTabs')
|
|
|
|
|
assert.match(source, /openTabs\.includes\('audit'\)/, 'audit panel gated by openTabs')
|
|
|
|
|
assert.match(source, /function closeTab\(/, 'closeTab handler')
|
|
|
|
|
})
|