Skip to content

Commit

Permalink
Fix unit test and lint
Browse files Browse the repository at this point in the history
  • Loading branch information
obulat committed Oct 23, 2023
1 parent c39ca13 commit e6dd537
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 28 deletions.
4 changes: 2 additions & 2 deletions frontend/src/stores/media/index.ts
Expand Up @@ -441,8 +441,8 @@ export const useMediaStore = defineStore("media", {
mediaType: SupportedMediaType
shouldPersistMedia: boolean
}) {
const searchStore = useSearchStore()
const { pathSlug, query } = searchStore.getSearchUrlParts(mediaType)
const searchStore = useSearchStore()
const { pathSlug, query } = searchStore.getSearchUrlParts(mediaType)
let page = this.results[mediaType].page + 1
if (shouldPersistMedia) {
query.page = `${page}`
Expand Down
26 changes: 0 additions & 26 deletions frontend/test/unit/specs/stores/search-store.spec.js
Expand Up @@ -288,32 +288,6 @@ describe("Search Store", () => {
})
})

it("updateSearchPath updates searchType and query", () => {
const searchStore = useSearchStore()
searchStore.updateSearchPath({ type: "audio", searchTerm: "cat" })

expect(searchStore.searchType).toEqual("audio")
expect(searchStore.searchQueryParams).toEqual({ q: "cat" })
expect(searchStore.$nuxt.localePath).toHaveBeenCalledWith({
path: "/search/audio",
query: { q: "cat" },
})
})

it("updateSearchPath keeps searchType and query if none provided", () => {
const searchStore = useSearchStore()
searchStore.setSearchTerm("cat")
searchStore.setSearchType("audio")
searchStore.updateSearchPath()

expect(searchStore.searchType).toEqual("audio")
expect(searchStore.searchQueryParams).toEqual({ q: "cat" })
expect(searchStore.$nuxt.localePath).toHaveBeenCalledWith({
path: "/search/audio",
query: { q: "cat" },
})
})

it.each`
filters | query
${[["licenses", "by"], ["licenses", "by-nc-sa"]]} | ${["license", "by,by-nc-sa"]}
Expand Down

0 comments on commit e6dd537

Please sign in to comment.