@defra/lis-infra-ui-services 0.13.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defra/lis-infra-ui-services",
3
- "version": "0.13.0",
3
+ "version": "0.14.0",
4
4
  "description": "UI-Services shared definitions for the livestock taxonomy topology.",
5
5
  "main": "src/index.js",
6
6
  "repository": {
@@ -43,7 +43,7 @@ export function createNunjucksContextBuilder({
43
43
  assetPath: `${assetRoot}/assets`,
44
44
  serviceName: config.get('serviceName'),
45
45
  sectionName,
46
- serviceUrl: requestBasePath || '/',
46
+ serviceUrl: '/',
47
47
  breadcrumbs: [],
48
48
  navigation: buildNavigation(request),
49
49
  isSignedIn: Boolean(request?.app?.hubAuth),
@@ -138,3 +138,30 @@ test('createNunjucksContextBuilder logs once when the Vite manifest is unavailab
138
138
  )
139
139
  assert.deepEqual(loggerMessages, ['Vite manifest.json not found'])
140
140
  })
141
+
142
+ test('createNunjucksContextBuilder always sets serviceUrl to the hub root even when rendered under a spoke base path', () => {
143
+ const loggerMessages = []
144
+ const contextBuilder = createNunjucksContextBuilder({
145
+ config: createConfig(),
146
+ buildNavigation: () => [],
147
+ getRequestBasePath: () => '/cattle/register',
148
+ logger: {
149
+ error(loggedError, message) {
150
+ loggerMessages.push(message)
151
+ }
152
+ },
153
+ readFileSync() {
154
+ return JSON.stringify({
155
+ 'src/client/stylesheets/application.scss': {
156
+ file: 'assets/application-123.css'
157
+ }
158
+ })
159
+ }
160
+ })
161
+
162
+ const context = contextBuilder({ headers: {}, path: '/' })
163
+
164
+ assert.equal(context.serviceUrl, '/')
165
+ assert.equal(context.assetPath, '/cattle/register/public/assets')
166
+ assert.deepEqual(loggerMessages, [])
167
+ })