Service Workerが正しく登録できないのを修正
This commit is contained in:
17
tests/staticAssets.test.js
Normal file
17
tests/staticAssets.test.js
Normal 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">');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user