35 lines
1.7 KiB
JavaScript
35 lines
1.7 KiB
JavaScript
import assert from 'node:assert/strict'
|
|
import fs from 'node:fs'
|
|
import test from 'node:test'
|
|
|
|
const frontend = fs.readFileSync(new URL('../src/main.tsx', import.meta.url), 'utf8')
|
|
const native = fs.readFileSync(new URL('../src-tauri/src/enterprise_work_channel.rs', import.meta.url), 'utf8')
|
|
const pncc = fs.readFileSync(new URL('../src-tauri/src/user_pncc_channel.rs', import.meta.url), 'utf8')
|
|
|
|
test('every enterprise login enters through Zero Sense and Guanghu Channel before its responsibility domain', () => {
|
|
assert.match(frontend, /光湖零感域/)
|
|
assert.match(frontend, /公共工作入口/)
|
|
assert.match(frontend, /光湖频道/)
|
|
assert.match(frontend, /本人责任工作域/)
|
|
assert.match(frontend, /worldStage === 'enterpriseWork'/)
|
|
assert.match(native, /work_entry_domain: "ZERO_SENSE_DOMAIN"/)
|
|
assert.match(native, /work_entry_channel: "GUANGHU_CHANNEL"/)
|
|
})
|
|
|
|
test('enterprise work repositories are exact private read-only projections and never personal channels', () => {
|
|
for (const repository of [
|
|
'huaer/guanghu-branch-work',
|
|
'yeye/guanghu-zero-work',
|
|
'feimao/guanghu-zero-sense-work',
|
|
'juzi/guanghu-zero-sense-work',
|
|
'awen/guanghu-main-work',
|
|
]) assert.match(native, new RegExp(repository.replace('/', '\\/')))
|
|
assert.match(native, /AUTHENTICATED_USER_READ_ONLY_NO_PUSH_NO_PERSONAL_NODE_AUTHORITY/)
|
|
assert.match(frontend, /个人生活区不会由企业工作账号代建/)
|
|
assert.match(pncc, /if domain != "FIFTH_DOMAIN"/)
|
|
})
|
|
|
|
test('enterprise responsibility receipts report their private Git projection to the human', () => {
|
|
assert.match(frontend, /repository_projection/)
|
|
assert.match(frontend, /写入本人私有工作仓库/)
|
|
})
|