|
|
@@ -8,6 +8,10 @@ const rules = require('../utils/teamBackgroundFile')
|
|
|
assert.equal(rules.validateEnterpriseWebsite(' 无 '), '')
|
|
|
assert.equal(rules.validateEnterpriseWebsite('https://example.com'), '')
|
|
|
assert.match(rules.validateEnterpriseWebsite('ftp://example.com'), /http/)
|
|
|
+const websiteWithLength = length => `https://example.com/${'a'.repeat(length - 20)}`
|
|
|
+assert.equal(rules.validateEnterpriseWebsite(websiteWithLength(499)), '')
|
|
|
+assert.equal(rules.validateEnterpriseWebsite(websiteWithLength(500)), '')
|
|
|
+assert.match(rules.validateEnterpriseWebsite(websiteWithLength(501)), /500/)
|
|
|
assert.equal(rules.validateBackgroundFile({ name: 'brief.PDF', size: 1 }), '')
|
|
|
assert.match(rules.validateBackgroundFile({ name: 'brief.zip', size: 1 }), /类型/)
|
|
|
assert.match(rules.validateBackgroundFile({ name: 'brief.pdf', size: 50 * 1024 * 1024 + 1 }), /50MB/)
|
|
|
@@ -1029,6 +1033,45 @@ async function testFileActionsWaitForCurrentListAndDocumentContext() {
|
|
|
assert.ok(toasts.some(message => String(message).includes('open failed')))
|
|
|
}
|
|
|
|
|
|
+async function testSameTeamRefreshFailurePreservesExistingFilesAndCount() {
|
|
|
+ const listRequest = createDeferred()
|
|
|
+ const emittedCounts = []
|
|
|
+ const component = await loadVueComponent(backgroundComponentPath, {
|
|
|
+ http: { listTeamBackgroundFiles: () => listRequest.promise }
|
|
|
+ })
|
|
|
+ const instance = instantiateComponent(component, {
|
|
|
+ teamId: '', editable: true, $showToast() {},
|
|
|
+ $emit(name, value) { if (name === 'countChange') emittedCounts.push(value) }
|
|
|
+ })
|
|
|
+ instance.resetTeamContext(30)
|
|
|
+ const existingFiles = [{ id: 301, fileName: 'existing.pdf' }]
|
|
|
+ instance.files = existingFiles
|
|
|
+ instance.count = 1
|
|
|
+ instance.filesReady = true
|
|
|
+ instance.hasLoadedFiles = true
|
|
|
+ emittedCounts.length = 0
|
|
|
+
|
|
|
+ const refresh = instance.refreshFiles(30)
|
|
|
+ assert.equal(instance.files, existingFiles, 'same-team refresh must retain the visible list while loading')
|
|
|
+ assert.equal(instance.count, 1)
|
|
|
+ assert.deepEqual(emittedCounts, [], 'same-team refresh must not transiently emit zero')
|
|
|
+ listRequest.reject(new Error('refresh failed'))
|
|
|
+ await assert.rejects(refresh, /refresh failed/)
|
|
|
+ assert.equal(instance.files, existingFiles)
|
|
|
+ assert.equal(instance.count, 1)
|
|
|
+ assert.deepEqual(emittedCounts, [])
|
|
|
+
|
|
|
+ instance.resetTeamContext(31)
|
|
|
+ assert.equal(instance.files.length, 0)
|
|
|
+ assert.equal(instance.count, 0)
|
|
|
+ assert.deepEqual(emittedCounts, [0], 'switching teams must still clear the old count immediately')
|
|
|
+}
|
|
|
+
|
|
|
+async function testTeamWebsiteInputExposesTheAuthoritativeLengthLimit() {
|
|
|
+ const source = fs.readFileSync(teamFillComponentPath, 'utf8')
|
|
|
+ assert.match(source, /v-model="teamInfo\.enterpriseWebsite"[^>]*maxlength="500"/)
|
|
|
+}
|
|
|
+
|
|
|
async function testTeamFillFlushesBeforeEmitAndLocks() {
|
|
|
const component = await loadVueComponent(teamFillComponentPath)
|
|
|
const flushDeferred = createDeferred()
|
|
|
@@ -1447,6 +1490,8 @@ async function main() {
|
|
|
await testDeferredPcWaiterSingleFlightFinishesAllCallers()
|
|
|
await testTeamContextResetAndUploadIsolation()
|
|
|
await testFileActionsWaitForCurrentListAndDocumentContext()
|
|
|
+ await testSameTeamRefreshFailurePreservesExistingFilesAndCount()
|
|
|
+ await testTeamWebsiteInputExposesTheAuthoritativeLengthLimit()
|
|
|
await testTeamFillFlushesBeforeEmitAndLocks()
|
|
|
await testCreatedTeamResumeAndSubmitLock()
|
|
|
await testCreatedTeamNavigationIsAwaitableAndResumable()
|