diff --git a/code/client/src/pwa/pwa-config.ts b/code/client/src/pwa/pwa-config.ts index e3166315..64df15db 100644 --- a/code/client/src/pwa/pwa-config.ts +++ b/code/client/src/pwa/pwa-config.ts @@ -1,16 +1,10 @@ -//import { injectConfig } from './inject-config'; import { manifestConfig } from '@pwa/manifest-config'; import { VitePWAOptions } from 'vite-plugin-pwa'; -import { workboxConfig } from '@pwa/workbox-config'; export const pwaConfig: Partial = { mode: 'development', strategies: 'generateSW', - //injectRegister: false, - //injectManifest: injectConfig, - //registerType: 'prompt', manifest: manifestConfig, - workbox: workboxConfig, devOptions: { enabled: true, navigateFallback: 'index.html', diff --git a/code/client/src/pwa/service-worker.ts b/code/client/src/pwa/service-worker.ts deleted file mode 100644 index 4243c071..00000000 --- a/code/client/src/pwa/service-worker.ts +++ /dev/null @@ -1,8 +0,0 @@ -// eslint-disable-next-line @typescript-eslint/no-unused-vars -self.addEventListener('install', event => { - console.log('Service worker installing...'); -}); - -self.addEventListener('fetch', event => { - console.log('Fetching:', event); -}); diff --git a/code/client/src/pwa/workbox-config.ts b/code/client/src/pwa/workbox-config.ts deleted file mode 100644 index 81a1fe7d..00000000 --- a/code/client/src/pwa/workbox-config.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { GenerateSWOptions } from 'workbox-build'; - -export const workboxConfig: Partial = { - runtimeCaching: [ - { - urlPattern: ({ url }) => url.pathname.startsWith('/'), - handler: async ({ event }) => { - console.log('Fetching:', event); - try { - const resp = await fetch(event.request); - console.log('Fetched:', resp); - return resp; - } catch (error) { - // Fetch failed, fetch from cache - console.error('Error:', error); - return caches.match(event.request); - } - }, - options: { - cacheName: 'app-cache', - cacheableResponse: { statuses: [0, 200] }, - }, - }, - // api calls to localhost:8080 - { - urlPattern: ({ url }) => url.origin === 'http://localhost:8080', - handler: async ({ event }) => { - console.log('Fetching:', event); - try { - const resp = fetch(event.request); - console.log('Fetched:', resp); - return resp; - } catch (error) { - console.error('Error:', error); - const cache = await caches.open('api-cache'); - const cachedResponse = await cache.match(event.request); - return cachedResponse; - } - }, - options: { - cacheName: 'api-cache', - cacheableResponse: { statuses: [0, 200] }, - expiration: { - maxEntries: 10, - maxAgeSeconds: 60, - }, - }, - }, - ], - //importScripts: ['./service-worker'], - //cleanupOutdatedCaches: true, -}; diff --git a/code/server/test/commits/commits.test.ts b/code/server/test/documents/commits.test.ts similarity index 100% rename from code/server/test/commits/commits.test.ts rename to code/server/test/documents/commits.test.ts diff --git a/code/server/test/resources/resources.test.ts b/code/server/test/resources/resources.test.ts index 73c39548..7dadcc1f 100644 --- a/code/server/test/resources/resources.test.ts +++ b/code/server/test/resources/resources.test.ts @@ -1,7 +1,7 @@ import { TestDatabases } from '../../src/databases/TestDatabases'; import { Services } from '../../src/services/Services'; import { ResourceType } from '@notespace/shared/src/workspace/types/resource'; -import { excludeRoot } from '../workspaces/utils'; +import { excludeRoot } from '../utils'; let services: Services; diff --git a/code/server/test/users/authentication.test.ts b/code/server/test/users/authentication.test.ts deleted file mode 100644 index 84828875..00000000 --- a/code/server/test/users/authentication.test.ts +++ /dev/null @@ -1,8 +0,0 @@ -// implement integration tests for user authentication using firebase auth sdk - -describe('User authentication', () => { - test('should register a user', async () => { - // TODO - expect(true).toBe(true); - }); -}); diff --git a/code/server/test/utils.ts b/code/server/test/utils.ts index 32f927ea..f68803fb 100644 --- a/code/server/test/utils.ts +++ b/code/server/test/utils.ts @@ -1,6 +1,6 @@ import { getRandomId } from '../src/services/utils'; import { Services } from '../src/services/Services'; -import { ResourceType } from '@notespace/shared/src/workspace/types/resource'; +import { Resource, ResourceType } from '@notespace/shared/src/workspace/types/resource'; import { InsertOperation } from '@notespace/shared/src/document/types/operations'; import { Author } from '@notespace/shared/src/document/types/commits'; @@ -36,3 +36,7 @@ export async function createTestCommit(services: Services) { return { wid, id, author, commitId, operation }; } + +export function excludeRoot(wid: string, resources: Resource[]): Resource[] { + return resources.filter(r => r.id != wid); +} diff --git a/code/server/test/workspaces/tree.test.ts b/code/server/test/workspaces/tree.test.ts index 748e2600..5148f28d 100644 --- a/code/server/test/workspaces/tree.test.ts +++ b/code/server/test/workspaces/tree.test.ts @@ -1,7 +1,7 @@ import { TestDatabases } from '../../src/databases/TestDatabases'; import { Services } from '../../src/services/Services'; import { ResourceType } from '@notespace/shared/src/workspace/types/resource'; -import { excludeRoot } from './utils'; +import { excludeRoot } from '../utils'; let services: Services; diff --git a/code/server/test/workspaces/utils.ts b/code/server/test/workspaces/utils.ts deleted file mode 100644 index bcb684b0..00000000 --- a/code/server/test/workspaces/utils.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { Resource } from '@notespace/shared/src/workspace/types/resource'; - -export function excludeRoot(wid: string, resources: Resource[]): Resource[] { - return resources.filter(r => r.id != wid); -}