Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: check authorities in app adapter [LIBS-370] #757

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
Next Next commit
test: fix tests
  • Loading branch information
KaiVandivier committed Oct 21, 2022
commit 0668608d7517bf41a7d275717381918b81b3eb08
19 changes: 16 additions & 3 deletions cli/src/lib/formatAppAuthName.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const formatAppAuthName = require('./formatAppAuthName.js')
describe('core app handling', () => {
it('should handle core apps', () => {
const config = { coreApp: true, name: 'data-visualizer' }
const formattedAuthName = formatAppAuthName(config)
const formattedAuthName = formatAppAuthName({ config })

expect(formattedAuthName).toBe('M_dhis-web-data-visualizer')
})
Expand All @@ -12,15 +12,28 @@ describe('core app handling', () => {
describe('non-core app handling', () => {
it('should handle app names with hyphens', () => {
const config = { name: 'hyphenated-string-example' }
const formattedAuthName = formatAppAuthName(config)
const formattedAuthName = formatAppAuthName({ config })

expect(formattedAuthName).toBe('M_hyphenatedstringexample')
})

it('should handle app names with capitals and spaces', () => {
const config = { name: 'Multi Word App Name' }
const formattedAuthName = formatAppAuthName(config)
const formattedAuthName = formatAppAuthName({ config })

expect(formattedAuthName).toBe('M_Multi_Word_App_Name')
})
})

describe('legacy app handling', () => {
it('should use title instead of name if the legacy flag is added', () => {
const config = {
name: 'Multi Word App Name',
title: 'Title of the App',
}
const formattedAuthName = formatAppAuthName({ config, legacy: true })

expect(formattedAuthName).not.toBe('M_Multi_Word_App_Name')
expect(formattedAuthName).toBe('M_Title_of_the_App')
})
})