chore: 项目基线(基于 WeKnora 定制版,整理文件忽略规则)
This commit is contained in:
commit
9097ee699d
5769 files changed
+1446466
No files matched your search
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,37 @@
|
||||
import assert from 'node:assert/strict'
|
||||
import { readFileSync } from 'node:fs'
|
||||
import test from 'node:test'
|
||||
|
||||
const source = readFileSync(new URL('./OrganizationSettingsModal.vue', import.meta.url), 'utf8')
|
||||
// 遮罩层由共享壳 SettingsModalShell 渲染,overscroll 规则也随之搬到那里。
|
||||
const shellSource = readFileSync(new URL('../../components/SettingsModalShell.vue', import.meta.url), 'utf8')
|
||||
|
||||
test('reviewing join requests goes through the store and refreshes modal data', () => {
|
||||
assert.match(
|
||||
source,
|
||||
/const refreshOrganizationAfterReview = async \(\) => \{\s*await Promise\.all\(\[\s*fetchOrgDetail\(\),\s*fetchMembers\(\)\s*\]\)\s*\}/
|
||||
)
|
||||
|
||||
assert.match(source, /orgStore\.reviewOrganizationJoinRequest\(/)
|
||||
const refreshCalls = source.match(/await refreshOrganizationAfterReview\(\)/g) ?? []
|
||||
assert.equal(refreshCalls.length, 2)
|
||||
})
|
||||
|
||||
test('organization settings use one outer content scroller and reset it on navigation', () => {
|
||||
assert.match(source, /ref="contentWrapperRef" class="content-wrapper"/)
|
||||
assert.match(source, /class="data-table-shell members-table-shell"/)
|
||||
assert.match(source, /contentWrapperRef\.value\?\.scrollTo\(\{ top: 0, behavior: 'auto' \}\)/)
|
||||
assert.match(source, /watch\(\(\) => props\.visible,[\s\S]*?void scrollContentToTop\(\)/)
|
||||
assert.match(source, /\}, \{ immediate: true \}\)\s*\n\s*watch\(\(\) => props\.orgId/)
|
||||
assert.match(source, /watch\(\(\) => props\.orgId,[\s\S]*?void scrollContentToTop\(\)/)
|
||||
assert.match(source, /watch\(currentSection,[\s\S]*?void scrollContentToTop\(\)/)
|
||||
assert.match(source, /\.members-table-shell\s*\{[\s\S]*?overflow: visible;[\s\S]*?\.t-table__content/)
|
||||
})
|
||||
|
||||
test('organization settings lock and restore background scrolling', () => {
|
||||
assert.match(source, /document\.body\.style\.overflow = 'hidden'/)
|
||||
assert.match(source, /document\.body\.style\.overflow = previousBodyOverflow/)
|
||||
assert.match(source, /onBeforeUnmount\(\(\) => \{\s*unlockBackgroundScroll\(\)/)
|
||||
assert.match(shellSource, /\.settings-overlay\s*\{[\s\S]*?overscroll-behavior: none;/)
|
||||
assert.match(source, /\.content-wrapper\s*\{[\s\S]*?overscroll-behavior: contain;/)
|
||||
})
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,66 @@
|
||||
import assert from 'node:assert/strict'
|
||||
import { readFileSync } from 'node:fs'
|
||||
import test from 'node:test'
|
||||
|
||||
const listSource = readFileSync(new URL('./OrganizationList.vue', import.meta.url), 'utf8')
|
||||
const settingsSource = readFileSync(new URL('./OrganizationSettingsModal.vue', import.meta.url), 'utf8')
|
||||
const kbShareSource = readFileSync(
|
||||
new URL('../knowledge/settings/KBShareSettings.vue', import.meta.url),
|
||||
'utf8'
|
||||
)
|
||||
const agentShareSource = readFileSync(
|
||||
new URL('../../components/AgentShareSettings.vue', import.meta.url),
|
||||
'utf8'
|
||||
)
|
||||
const storeSource = readFileSync(
|
||||
new URL('../../stores/organization.ts', import.meta.url),
|
||||
'utf8'
|
||||
)
|
||||
|
||||
test('organization list directly derives cards from the store', () => {
|
||||
assert.match(
|
||||
listSource,
|
||||
/const organizations = computed<OrgWithUI\[\]>\(\(\) => orgStore\.organizations\)/
|
||||
)
|
||||
assert.doesNotMatch(listSource, /organizations\.value = newOrgs\.map/)
|
||||
})
|
||||
|
||||
test('join flows and searchable cache are coordinated by the store', () => {
|
||||
assert.match(listSource, /orgStore\.join\(inviteCode\.value\)/)
|
||||
assert.match(listSource, /orgStore\.joinById\(/)
|
||||
assert.match(listSource, /orgStore\.fetchSearchableOrganizations\(/)
|
||||
assert.doesNotMatch(listSource, /const searchCache = ref/)
|
||||
})
|
||||
|
||||
test('organization settings writes use store actions', () => {
|
||||
for (const action of [
|
||||
'updateOrganization',
|
||||
'reviewOrganizationJoinRequest',
|
||||
'inviteOrganizationMember',
|
||||
'requestOrganizationRoleUpgrade',
|
||||
'unshareKnowledgeBase',
|
||||
'unshareAgent'
|
||||
]) {
|
||||
assert.match(settingsSource, new RegExp(`orgStore\\.${action}\\(`))
|
||||
}
|
||||
})
|
||||
|
||||
test('knowledge base and agent share editors use store actions', () => {
|
||||
assert.match(kbShareSource, /orgStore\.shareKnowledgeBase\(/)
|
||||
assert.match(kbShareSource, /orgStore\.unshareKnowledgeBase\(/)
|
||||
assert.match(kbShareSource, /orgStore\.changeKnowledgeBaseSharePermission\(/)
|
||||
assert.match(agentShareSource, /orgStore\.shareAgent\(/)
|
||||
assert.match(agentShareSource, /orgStore\.unshareAgent\(/)
|
||||
})
|
||||
|
||||
test('store invalidates all affected organization caches after sharing', () => {
|
||||
assert.match(
|
||||
storeSource,
|
||||
/invalidateOrganizationData\(\{ sharedKnowledgeBases: true \}\)/
|
||||
)
|
||||
assert.match(
|
||||
storeSource,
|
||||
/invalidateOrganizationData\(\{ sharedAgents: true, sharedKnowledgeBases: true \}\)/
|
||||
)
|
||||
assert.match(storeSource, /adjustOrganizationResourceCount\(/)
|
||||
})
|
||||
Reference in new issue
Block a user