Skip to content

Commit 7f7e44b

Browse files
fix: correct chai have.property assertions — drop second arg used as message
chai's have.property(name, val) treats val as expected value, not error message. This caused test 11 (pagination) to fail because chai checked _asset_scan_status === 'Page item blt... is missing...' instead of just verifying the property exists. All 7 affected assertions fixed: - 5x .not.have.property(name, msg) → .not.have.property(name) (false-pass bug: would pass even if property existed with any value) - 1x .have.property(name, msg) → expect(obj, msg).to.have.property(name) (was the direct failure in pagination test) - 1x api_version header check in §4.2 Verified locally: 23 passing, 0 failing, 9 pending (publish/AM skips expected)
1 parent b0972f7 commit 7f7e44b

1 file changed

Lines changed: 7 additions & 14 deletions

File tree

test/sanity-check/api/assetScanStatus-test.js

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,7 @@ describe('Asset Scan Status – Non-AM Org (ORGANIZATION)', () => {
164164
const asset = await stack.asset(freshAssetUid).fetch()
165165

166166
expect(asset).to.be.an('object')
167-
expect(asset).to.not.have.property('_asset_scan_status',
168-
'_asset_scan_status must be absent when include_asset_scan_status is not passed')
167+
expect(asset).to.not.have.property('_asset_scan_status')
169168
})
170169

171170
// --------------------------------------------------------------------------
@@ -205,8 +204,7 @@ describe('Asset Scan Status – Non-AM Org (ORGANIZATION)', () => {
205204
expect(response.items).to.be.an('array')
206205

207206
response.items.filter(i => !i.is_dir).forEach(item => {
208-
expect(item).to.not.have.property('_asset_scan_status',
209-
`Asset ${item.uid} should not have _asset_scan_status without param`)
207+
expect(item).to.not.have.property('_asset_scan_status')
210208
})
211209
})
212210

@@ -309,8 +307,7 @@ describe('Asset Scan Status – Non-AM Org (ORGANIZATION)', () => {
309307

310308
folders.forEach(folder => {
311309
// Folders should NOT have a scan status — they're containers, not content files
312-
expect(folder).to.not.have.property('_asset_scan_status',
313-
`Folder ${folder.uid} should not have _asset_scan_status`)
310+
expect(folder).to.not.have.property('_asset_scan_status')
314311
})
315312
})
316313

@@ -337,8 +334,7 @@ describe('Asset Scan Status – Non-AM Org (ORGANIZATION)', () => {
337334
if (!hasField) return // Feature not active — skip silently
338335

339336
allItems.forEach(item => {
340-
expect(item).to.have.property('_asset_scan_status',
341-
`Page item ${item.uid} is missing _asset_scan_status`)
337+
expect(item, `Page item ${item.uid} is missing _asset_scan_status`).to.have.property('_asset_scan_status')
342338
// § 3.6: null is valid for legacy assets
343339
expect(isValidScanStatusOrLegacy(item._asset_scan_status)).to.equal(true,
344340
`Page item ${item.uid} has invalid scan status: ${JSON.stringify(item._asset_scan_status)}`)
@@ -355,8 +351,7 @@ describe('Asset Scan Status – Non-AM Org (ORGANIZATION)', () => {
355351
const asset = await stack.asset(freshAssetUid).fetch({ include_asset_scan_status: false })
356352

357353
expect(asset).to.be.an('object')
358-
expect(asset).to.not.have.property('_asset_scan_status',
359-
'_asset_scan_status must be absent when param is explicitly set to false')
354+
expect(asset).to.not.have.property('_asset_scan_status')
360355
})
361356
})
362357

@@ -412,8 +407,7 @@ describe('Asset Scan Status – Upload Response (§ 3.2)', () => {
412407
})
413408

414409
expect(asset).to.be.an('object')
415-
expect(asset).to.not.have.property('_asset_scan_status',
416-
'Upload response must not include _asset_scan_status unless the param is explicitly requested')
410+
expect(asset).to.not.have.property('_asset_scan_status')
417411

418412
try { await stack.asset(asset.uid).delete() } catch (e) { /* ignore */ }
419413
})
@@ -692,8 +686,7 @@ describe('Asset Scan Status – api_version Header Isolation (§ 4.2)', () => {
692686

693687
const lastReq = ctx.capturedRequests[ctx.capturedRequests.length - 1]
694688
if (lastReq && lastReq.headers) {
695-
expect(lastReq.headers).to.not.have.property('api_version',
696-
'api_version header must not bleed from bulkOperation.publish() into subsequent asset fetches')
689+
expect(lastReq.headers).to.not.have.property('api_version')
697690
}
698691
}
699692

0 commit comments

Comments
 (0)