-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Co-authored-by: ulrichschulte <[email protected]>
- Loading branch information
1 parent
c410e9c
commit eff73bb
Showing
12 changed files
with
145 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
spring-boot-admin-server-ui/src/main/frontend/services/instance.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { describe, expect, test, vi } from 'vitest'; | ||
|
||
import Instance from '@/services/instance'; | ||
|
||
const { useSbaConfig } = vi.hoisted(() => ({ | ||
useSbaConfig: vi.fn().mockReturnValue(true), | ||
})); | ||
|
||
vi.mock('@/sba-config', async (importOriginal) => ({ | ||
...(await importOriginal<typeof import('@/sba-config')>()), | ||
useSbaConfig, | ||
})); | ||
|
||
describe('Instance', () => { | ||
test.each` | ||
hideInstanceUrl | metadataHideUrl | expectUrlToBeShownOnUI | ||
${false} | ${'true'} | ${false} | ||
${false} | ${'false'} | ${true} | ||
${false} | ${undefined} | ${true} | ||
${true} | ${'true'} | ${false} | ||
${true} | ${'false'} | ${false} | ||
`( | ||
'showUrl when hideInstanceUrl=$hideInstanceUrl and metadataHideUrl=$metadataHideUrl should return $expectUrlToBeShownOnUI', | ||
({ hideInstanceUrl, metadataHideUrl, expectUrlToBeShownOnUI }) => { | ||
useSbaConfig.mockReturnValue({ | ||
uiSettings: { | ||
hideInstanceUrl, | ||
}, | ||
}); | ||
|
||
const instance = new Instance({ | ||
id: 'id', | ||
registration: { | ||
metadata: { | ||
['hide-url']: metadataHideUrl, | ||
}, | ||
}, | ||
}); | ||
|
||
expect(instance.showUrl()).toBe(expectUrlToBeShownOnUI); | ||
}, | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,7 +37,7 @@ describe('Navbar', function () { | |
}); | ||
|
||
render(Navbar); | ||
screen.logTestingPlaygroundURL(); | ||
|
||
expect(screen.getByTestId('usermenu')).toBeVisible(); | ||
expect(screen.getByText('[email protected]')).toBeVisible(); | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters