Skip to content

Commit

Permalink
chore: maybe fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
harlan-zw committed Feb 25, 2025
1 parent fe400b5 commit b9adfa8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ export default defineNuxtModule<ModuleOptions>({
const credits = componentFile.split('\n').find(line => line.startsWith(' * @credits'))?.replace('* @credits', '').trim()
ogImageComponentCtx.components.push({
// purge cache when component changes
hash: hash(componentFile),
hash: hash(componentFile).replaceAll('_', '-'),
pascalName: component.pascalName,
kebabName: component.kebabName,
path: nuxt.options.dev ? component.filePath : undefined,
Expand Down
4 changes: 2 additions & 2 deletions src/runtime/server/util/kit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import { withoutBase, withoutTrailingSlash } from 'ufo'

export function fetchIsland(e: H3Event, component: string, props: Record<string, any>): Promise<NuxtIslandResponse> {
// using Nuxt Island, generate the og:image HTML
const hashId = hash([component, props])
return e.$fetch<NuxtIslandResponse>(`/__nuxt_island/${component}_${hashId.replace('_', '-')}.json`, {
const hashId = hash([component, props]).replaceAll('_', '-')
return e.$fetch<NuxtIslandResponse>(`/__nuxt_island/${component}_${hashId}.json`, {
params: {
props: JSON.stringify(props),
},
Expand Down
2 changes: 1 addition & 1 deletion test/integration/dev-debugging.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe('dev', () => {
json.options.component = json.options.component.replace('OgImage', '')
expect(json).toMatchInlineSnapshot(`
{
"cacheKey": "satori:5Hzq5ZrLws",
"cacheKey": "satori:85xUPyRysj54MgqRPbu0CZWgsg_WmC4BeJvBJez5bVw",
"compatibilityHints": [],
"options": {
"cacheMaxAgeSeconds": 259200,
Expand Down

0 comments on commit b9adfa8

Please sign in to comment.