Skip to content

Commit

Permalink
fix: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
HenryT-CG committed Oct 4, 2024
1 parent bf279f5 commit 56d48e2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 16 deletions.
16 changes: 9 additions & 7 deletions src/app/theme/theme-detail/theme-detail.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,15 @@ describe('ThemeDetailComponent', () => {
expect(component.loading).toBe(false)
})

it('should set showOperatorMessage to false', async () => {
const event = { index: 1 }

await component.ngOnInit()
component.onTabChange(event)

expect(component.showOperatorMessage).toBeFalsy()
})

it('should create with default dateFormat', async () => {
// recreate component to test constructor
initializeComponent()
Expand Down Expand Up @@ -267,13 +276,6 @@ describe('ThemeDetailComponent', () => {
expect(component.onClose).toHaveBeenCalledTimes(1)
})

it('should return empty string if theme has no workspaces', () => {
component.theme = undefined

const result = component.prepareWorkspaceList()
expect(result).toBe('')
})

it('should navigate back on close', () => {
component.ngOnInit()
component.onClose()
Expand Down
11 changes: 2 additions & 9 deletions src/app/theme/theme-detail/theme-detail.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@ import FileSaver from 'file-saver'

import { Action, PortalMessageService, UserService } from '@onecx/portal-integration-angular'

import { sortByLocale, bffImageUrl, getCurrentDateTime } from 'src/app/shared/utils'
import { bffImageUrl, getCurrentDateTime } from 'src/app/shared/utils'
import {
ExportThemeRequest,
ImagesInternalAPIService,
RefType,
Theme,
ThemesAPIService,
Workspace
ThemesAPIService
} from 'src/app/shared/generated'

@Component({
Expand Down Expand Up @@ -187,12 +186,6 @@ export class ThemeDetailComponent implements OnInit {
}
}

public prepareWorkspaceList(workspace?: Workspace[]): string {
const arr = workspace?.map((workspace: Workspace) => workspace.name)
arr?.sort(sortByLocale)
return arr ? arr.join(', ') : ''
}

public getImageUrl(theme: Theme | undefined, refType: RefType): string | undefined {
if (!theme) {
return undefined
Expand Down

0 comments on commit 56d48e2

Please sign in to comment.