Skip to content

Commit

Permalink
Fixed original tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
hfekete committed Jun 27, 2024
1 parent 6ba8eec commit 70faa92
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
10 changes: 5 additions & 5 deletions cypress/support/commands.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Cypress.Commands.add('interceptBusinessSlim', (identifier, legalType, isHistorical) => {
Cypress.Commands.add('interceptBusinessInfo', (identifier, legalType, isHistorical) => {
cy.fixture(`business${legalType}`).then((business) => {
business.identifier = identifier
if (isHistorical) {
business.state = 'HISTORICAL'
}
cy.intercept(
'GET',
`**/api/v2/businesses/${business.identifier}?slim=true`,
`**/api/v2/businesses/${business.identifier}`,
{ business })
})
})
Expand Down Expand Up @@ -70,12 +70,12 @@ Cypress.Commands.add('visitBusinessDash', (identifier = 'BC0871427', legalType =
).as('getLdarklyContext')
cy.intercept('GET', '**/api/v1/orgs/**/products*', { fixture: 'products.json' }).as('getProducts')
cy.interceptBusinessContact(identifier, legalType).as('getBusinessContact')
cy.interceptBusinessSlim(identifier, legalType, isHistorical).as('getBusinessSlim')
cy.interceptBusinessInfo(identifier, legalType, isHistorical).as('getBusinessInfo')
cy.interceptAddresses(legalType).as('getAddresses')
cy.interceptParties(legalType, isHistorical).as('getParties')

cy.visit(`/${identifier}`)
cy.wait(['@getSettings', '@getProducts', '@getBusinessContact', '@getBusinessSlim', '@getAddresses', '@getParties'])
cy.wait(['@getSettings', '@getProducts', '@getBusinessContact', '@getBusinessInfo', '@getAddresses', '@getParties'])
cy.injectAxe()
})

Expand All @@ -88,7 +88,7 @@ Cypress.Commands.add('visitBusinessDashAuthError', (identifier = 'BC0871427', le
{ fixture: 'ldarklyContext.json' }
).as('getLdarklyContext')
cy.interceptBusinessContact(identifier, legalType).as('getBusinessContact')
cy.interceptBusinessSlim(identifier, legalType).as('getBusinessSlim')
cy.interceptBusinessInfo(identifier, legalType).as('getBusinessInfo')
cy.visit(`/${identifier}`)
cy.wait(['@getSettingsError'])
cy.injectAxe()
Expand Down
2 changes: 1 addition & 1 deletion src/components/bcros/businessDetails/LinkActions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ interface MenuActionItem extends DropdownItem {
const allActions: ComputedRef<Array<MenuActionItem>> = computed(() => {
return [
{ // <!-- View/Add Digital Credentials -->
showButton: currentBusiness.value.allowedActions.digitalBusinessCard &&
showButton: !!currentBusiness.value?.allowedActions?.digitalBusinessCard &&
getStoredFlag('enable-digital-credentials'),
disabled: false,
label: t('button.tombstone.menuAction.digitalCredentials'),
Expand Down
4 changes: 2 additions & 2 deletions src/components/bcros/businessDetails/Status.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<header class="flex flex-row gap-1.5 text-sm">
<div class="flex flex-row gap-1.5 text-sm">
<template v-if="!!currentBusiness.identifier">
<div v-if="currentBusiness.state === BusinessStateE.HISTORICAL" class="flex flex-row gap-1.5">
<BcrosChips :label="$t('label.business.status.historical')" />
Expand All @@ -26,7 +26,7 @@
<!-- {{ appDescription }}-->
<!-- </div>-->
<!-- </template>-->
</header>
</div>
</template>

<script setup lang="ts">
Expand Down
1 change: 0 additions & 1 deletion src/interfaces/business-i.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ export interface BusinessWarningI {
data?: any // optional extra properties (eg, amalgamationDate)
}


// comments come from business-filings-ui project ApiBusinessIF interface
export interface BusinessI {
adminFreeze: boolean
Expand Down
3 changes: 3 additions & 0 deletions src/stores/business.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,9 @@ export const useBcrosBusiness = defineStore('bcros/business', () => {
})

const isAllowedToFile = (filingType: FilingTypes, filingSubType?: FilingSubTypeE) => {
if (!filingType || !currentBusiness.value?.allowedActions?.filing) {
return false
}
const requestedFiling = currentBusiness.value.allowedActions.filing.filingTypes
.find(ft => ft.name === filingType && (filingSubType === undefined || ft.type === filingSubType))
return !!requestedFiling
Expand Down

0 comments on commit 70faa92

Please sign in to comment.