diff --git a/shell/plugins/steve/__tests__/getters.test.ts b/shell/plugins/steve/__tests__/getters.test.ts index 424a26cf42..ca2dbac0a0 100644 --- a/shell/plugins/steve/__tests__/getters.test.ts +++ b/shell/plugins/steve/__tests__/getters.test.ts @@ -1,6 +1,8 @@ import _getters from '@shell/plugins/steve/getters'; -const { urlFor, urlOptions, pathExistsInSchema } = _getters; +const { + urlFor, urlOptions, pathExistsInSchema, isSteveUrl +} = _getters; describe('steve: getters:', () => { describe('urlFor', () => { @@ -67,17 +69,14 @@ describe('steve: getters:', () => { describe('urlOptions', () => { // we're not testing function output based off of state or getter inputs here since they are dependencies - const state = { config: { baseUrl: 'protocol' } }; - const getters = { - normalizeType: (type) => type, - // this has its own tests so it just returns the input string - urlOptions: (string) => string - }; + const state = { }; + const isSteveUrlGetter = isSteveUrl(); + const getters = { isSteveUrl: isSteveUrlGetter }; - const urlOptionsGetter = urlOptions(); + const urlOptionsGetter = urlOptions(state, getters); it('expects urlOptions to return a function', () => { - expect(typeof urlOptions(state, getters)).toBe('function'); + expect(typeof urlOptions()).toBe('function'); }); it('returns undefined when called without params', () => { expect(urlOptionsGetter()).toBeUndefined(); diff --git a/shell/plugins/steve/getters.js b/shell/plugins/steve/getters.js index 05acccfb04..2bb0732c06 100644 --- a/shell/plugins/steve/getters.js +++ b/shell/plugins/steve/getters.js @@ -52,7 +52,7 @@ export default { urlOptions: (state, getters) => (url, opt, schema) => { opt = opt || {}; - const parsedUrl = parse(url); + const parsedUrl = parse(url || ''); const isSteveUrl = getters.isSteveUrl(parsedUrl.path); const stevePagination = stevePaginationUtils.createParamsForPagination(schema, opt);