Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
querkmachine committed Apr 11, 2023
1 parent d7f3a70 commit 45ba384
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/govuk/helpers/colour.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,10 @@ describe('@function govuk-organisation-colour', () => {
),
'broom-regulatory-control': (
colour: #A81223
),
'house-elf-equalities-office': (
colour: #786999,
deprecation-message: 'The House Elf Equalities Office was disbanded in 2007.'
)
);
Expand Down Expand Up @@ -346,6 +350,25 @@ describe('@function govuk-organisation-colour', () => {
})
})

it('outputs a warning if the organisation has been deprecated', async () => {
const sass = `
${sassBootstrap}
.foo {
color: govuk-organisation-colour('house-elf-equalities-office');
}
`

await compileSassString(sass, sassConfig)

// Expect our mocked @warn function to have been called once with a single
// argument, which should be the deprecation notice
expect(mockWarnFunction.mock.calls[0])
.toEqual(expect.arrayContaining([
'The House Elf Equalities Office was disbanded in 2007.'
]))
})

it('throws an error if a non-existent organisation is requested', async () => {
const sass = `
${sassBootstrap}
Expand Down

0 comments on commit 45ba384

Please sign in to comment.