Skip to content
Merged
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
22 changes: 22 additions & 0 deletions src/lib/seam/components/SupportedDevices/device-models.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import type {
import {
applyEmbedExclusions,
filterDeviceModels,
getCapabilityLabel,
getCapabilityOptions,
getCapabilityRequirementMessages,
getProvidersWithMissingRequirements,
Expand Down Expand Up @@ -112,6 +113,27 @@ const models = [
deviceModel({ slug: 'd', manufacturer: null, deviceType: null }),
]

test('card assignment is independently displayed and filterable without encoding', () => {
const model = deviceModel({
slug: 'card-reader',
capabilities: {
cloud: {
can_assign_plastic_cards: 'conditionally',
can_encode_plastic_cards: 'no',
},
},
})
expect(
getSupportedCapabilities(model).map(({ name }) => ({
name,
label: getCapabilityLabel(name),
}))
).toEqual([{ name: 'can_assign_plastic_cards', label: 'Assign key cards' }])
expect(getCapabilityOptions([model]).map(({ value }) => value)).toEqual([
'can_assign_plastic_cards',
])
})

test('applyEmbedExclusions: without exclusions returns the models', () => {
expect(applyEmbedExclusions(models, null)).toBe(models)
expect(applyEmbedExclusions(models, noExclusions)).toHaveLength(4)
Expand Down
3 changes: 2 additions & 1 deletion src/lib/seam/components/SupportedDevices/device-models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ export const capabilityLabels: Partial<Record<CapabilityName, string>> = {
can_program_offline_access_codes: 'Offline access codes',
can_provision_mobile_keys: 'Mobile keys',
can_provision_wallet_keys: 'Wallet keys',
can_encode_plastic_cards: 'Key cards',
can_encode_plastic_cards: 'Encode key cards',
can_assign_plastic_cards: 'Assign key cards',
can_hvac_heat: 'Heat',
can_hvac_cool: 'Cool',
can_hvac_auto: 'Heat and cool',
Expand Down
1 change: 1 addition & 0 deletions src/lib/seam/ecosystem/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ export type CapabilityName =
| 'can_remotely_unlock'
| 'can_remotely_lock'
| 'can_encode_plastic_cards'
| 'can_assign_plastic_cards'
| 'can_provision_mobile_keys'
| 'can_provision_wallet_keys'
| 'can_hvac_cool'
Expand Down
Loading