Skip to content

Commit

Permalink
Change as requested in review
Browse files Browse the repository at this point in the history
  • Loading branch information
BenSurgisonGDS committed Apr 17, 2023
1 parent 49a7cf3 commit 1bf1623
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/manage-prototype-handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,10 @@ function getTemplatesHandler (req, res) {
const availableTemplates = getPluginTemplates()

const commonTemplatesPackageName = '@govuk-prototype-kit/common-templates'
const govUkFrontendPackageName = 'govuk-frontend'
let commonTemplatesDetails
if (!availableTemplates.some(plugin => plugin.packageName === commonTemplatesPackageName)) {
const installedPlugins = plugins.listInstalledPlugins()
if (installedPlugins.includes(govUkFrontendPackageName) && !installedPlugins.includes(commonTemplatesPackageName)) {
commonTemplatesDetails = {
pluginDisplayName: plugins.preparePackageNameForDisplay(commonTemplatesPackageName),
installLink: `${contextPath}/plugins/install?package=${encodeURIComponent(commonTemplatesPackageName)}&returnTo=templates`
Expand Down
1 change: 1 addition & 0 deletions lib/manage-prototype-handlers.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ describe('manage-prototype-handlers', () => {
}
}])
plugins.preparePackageNameForDisplay.mockReturnValue(pluginDisplayName)
plugins.listInstalledPlugins.mockReturnValue([])
nunjucksConfiguration.getNunjucksAppEnv.mockImplementation(() => ({
render: () => view
}))
Expand Down

0 comments on commit 1bf1623

Please sign in to comment.