Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .talismanrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
fileignoreconfig:
- filename: package-lock.json
checksum: 80c8eb5270a1c4a0fa244d0f001d15867449d44954eb4d3f1ab7fa68c6f5446d
version: ""
- filename: test/sanity-check/sanity.js
checksum: f8b4b4b4492e04fd13338af9d99972807b4d61e2b0237a6c057d3f93d8c66d60
- filename: test/sanity-check/api/assetScanStatus-test.js
checksum: e3b1857fbe321e7125b55613acd58c3c0b2fd2462e7a14e48279ad35db4169e7
Comment on lines +4 to +7
version: "1.0"
67 changes: 67 additions & 0 deletions test/sanity-check/api/asset-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -981,4 +981,71 @@ describe('Asset API Tests', () => {
}
})
})

// ==========================================================================
// ASSET SCAN STATUS
// ==========================================================================

describe('Asset Scan Status', () => {
let scanAssetUid

before(async function () {
this.timeout(30000)
// Reuse the image asset uploaded earlier — avoids a redundant upload
if (testData.assets && testData.assets.image && testData.assets.image.uid) {
scanAssetUid = testData.assets.image.uid
return
}
// Fallback: create a fresh asset if the upload block didn't run
try {
const asset = await stack.asset().create({
upload: assetPath,
title: `Scan Status Asset ${Date.now()}`,
description: 'Fallback asset for scan-status tests'
})
scanAssetUid = asset.uid
} catch (err) {
// Individual tests will self-skip when scanAssetUid is unset
}
})

it('should accept include_asset_scan_status param on single asset fetch', async function () {
this.timeout(15000)
if (!scanAssetUid) return this.skip()

const asset = await stack.asset(scanAssetUid).fetch({ include_asset_scan_status: true })

expect(asset).to.be.an('object')
expect(asset.uid).to.equal(scanAssetUid)
// _asset_scan_status is opt-in: present only when asset scanning is enabled for the stack.
// Possible values: 'pending' | 'clean' | 'quarantined' | 'not_scanned'
if ('_asset_scan_status' in asset) {
expect(asset._asset_scan_status).to.be.a('string')
expect(['pending', 'clean', 'quarantined', 'not_scanned']).to.include(asset._asset_scan_status)
}
})

it('should accept include_asset_scan_status param on asset list query', async function () {
this.timeout(15000)

const response = await stack.asset().query({ include_asset_scan_status: true }).find()

expect(response).to.be.an('object')
expect(response.items).to.be.an('array')
if (response.items.length > 0 && '_asset_scan_status' in response.items[0]) {
expect(response.items[0]._asset_scan_status).to.be.a('string')
expect(['pending', 'clean', 'quarantined', 'not_scanned']).to.include(response.items[0]._asset_scan_status)
}
})
Comment on lines +989 to +1039

it('should NOT return _asset_scan_status when param is omitted', async function () {
this.timeout(15000)
if (!scanAssetUid) return this.skip()

const asset = await stack.asset(scanAssetUid).fetch()

expect(asset).to.be.an('object')
expect(asset).to.not.have.property('_asset_scan_status')
})
})
})
Loading
Loading