This commit is contained in:
@@ -87,11 +87,17 @@ function mountBasicInfo(t, userType, permissions = []) {
|
||||
},
|
||||
'../composables/useAssetFormatters': formatters,
|
||||
'@/composables/useAuth': { useAuth: () => ({ hasAuth }) },
|
||||
'@/components/business/package-silence/SilenceRecordsDialog.vue': {
|
||||
default: vue.defineComponent(() => () => null)
|
||||
},
|
||||
'@/store/modules/user': { useUserStore: () => user },
|
||||
'@/config/constants': {
|
||||
JULY_PERMISSIONS: { speedTier: { view: 'speed:view', update: 'speed:update' } }
|
||||
},
|
||||
'@/utils/business/format': { formatDateTime: (value) => String(value || '') },
|
||||
'@/utils/business/packageSilence': evaluate(
|
||||
readFileSync('src/utils/business/packageSilence.ts', 'utf8')
|
||||
),
|
||||
'@/utils/business/expiryEstimate': {
|
||||
getExpiryEstimateText: () => '-',
|
||||
getExpiryEstimateTooltip: () => '',
|
||||
@@ -179,6 +185,29 @@ function mountBasicInfo(t, userType, permissions = []) {
|
||||
|
||||
const textOf = (node) =>
|
||||
node.tag === '#comment' ? '' : node.text + node.children.map(textOf).join('')
|
||||
|
||||
test('enterprise account hides polling and realname writes while authorized start/stop remain', async (t) => {
|
||||
const { root, asset, user } = mountBasicInfo(t, 4)
|
||||
user.permissions = [
|
||||
'device_info:auto_polling',
|
||||
'iot_info:auto_polling',
|
||||
'iot_info:update_realname_status',
|
||||
'bound_card:update_realname_status',
|
||||
'iot_info:start',
|
||||
'iot_info:stop'
|
||||
]
|
||||
await vue.nextTick()
|
||||
assert.doesNotMatch(textOf(root), /自动轮询|更新实名状态/)
|
||||
assert.equal(nodesWithClass(root, 'binding-card').length, 2)
|
||||
asset.asset_type = 'card'
|
||||
asset.network_status = 0
|
||||
await vue.nextTick()
|
||||
assert.match(textOf(root), /启用此卡/)
|
||||
assert.doesNotMatch(textOf(root), /自动轮询|更新实名状态/)
|
||||
asset.network_status = 1
|
||||
await vue.nextTick()
|
||||
assert.match(textOf(root), /停用此卡/)
|
||||
})
|
||||
const nodesWithClass = (node, className) => [
|
||||
...(String(node.props.class || '')
|
||||
.split(' ')
|
||||
|
||||
Reference in New Issue
Block a user