Service Workerが正しく登録できないのを修正

This commit is contained in:
CyberRex
2026-05-25 12:25:37 +09:00
parent ef476402fc
commit 50b872b439
3 changed files with 20 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
import { describe, expect, it } from 'vitest';
import { createApp } from '../src/server/app.js';
describe('static assets', () => {
it('serves the push service worker as JavaScript instead of the app shell', async () => {
const app = createApp();
const response = await app.request('/push-sw.js');
const body = await response.text();
expect(response.status).toBe(200);
expect(response.headers.get('content-type')).toContain('javascript');
expect(body).toContain("self.addEventListener('push'");
expect(body).toContain('showNotification');
expect(body).not.toContain('<div id="root">');
});
});