Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,850 changes: 1,961 additions & 889 deletions package-lock.json

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@
"devDependencies": {
"@jitar/plugin-vite": "^0.8.2",
"@types/node": "22.8.6",
"@types/react": "^18.3.8",
"@types/react-dom": "^18.3.0",
"@types/react": "^19.0.0",
"@types/react-dom": "^19.0.0",
"@types/sanitize-html": "^2.13.0",
"@types/web-push": "^3.6.3",
"@typescript-eslint/eslint-plugin": "^7.15.0",
"@vitejs/plugin-react": "^4.3.1",
"@vitejs/plugin-react": "^4.3.4",
"@vitest/coverage-v8": "^2.1.1",
"auto-changelog": "^2.5.0",
"cpx2": "^7.0.1",
Expand All @@ -67,9 +67,9 @@
"eslint-plugin-sonarjs": "^1.0.3",
"tsc-alias": "^1.8.10",
"typescript": "5.6.2",
"vite": "^5.4.6",
"vite-plugin-pwa": "^0.20.5",
"vite-tsconfig-paths": "^5.0.1",
"vite": "^6.0.3",
"vite-plugin-pwa": "^0.21.1",
"vite-tsconfig-paths": "^5.1.3",
"vitest": "^2.1.1"
},
"optionalDependencies": {
Expand Down
4 changes: 3 additions & 1 deletion src/webui/hooks/useFocusOnMount.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@

import { RefObject, useEffect } from 'react';

export function useFocusOnMount(elementRef: RefObject<HTMLElement>)
export function useFocusOnMount(elementRef: RefObject<HTMLElement | null>)
{
useEffect(() =>
{
if (elementRef === null) return;

elementRef.current?.focus();

}, [elementRef]);
Expand Down
2 changes: 1 addition & 1 deletion test/domain/authentication/login.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describe('domain/authentication', () =>
it('should NOT register with too many occurrences nickname', async () =>
{
const promise = login(IDENTITIES.TOO_MANY_SIMILAR_NICKNAMES);
expect(promise).rejects.toStrictEqual(new TooManySimilarNicknames());
await expect(promise).rejects.toStrictEqual(new TooManySimilarNicknames());
});

it('should register with spaces in nickname', async () =>
Expand Down
2 changes: 1 addition & 1 deletion test/domain/creator/updateFullName.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ describe('domain/creator/updateFullName', () =>
it('should not accept an invalid full name', async () =>
{
const promise = updateFullName(REQUESTERS.CREATOR, VALUES.FULL_NAMES.INVALID);
expect(promise).rejects.toThrow(InvalidCreator);
await expect(promise).rejects.toThrow(InvalidCreator);
});
});
2 changes: 1 addition & 1 deletion test/domain/creator/updateNickname.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ describe('domain/creator/updateNickname', () =>
{
const promise = updateNickname(REQUESTERS.CREATOR, VALUES.NICKNAMES.DUPLICATE);

expect(promise).rejects.toStrictEqual(new NicknameAlreadyExists(VALUES.NICKNAMES.DUPLICATE));
await expect(promise).rejects.toStrictEqual(new NicknameAlreadyExists(VALUES.NICKNAMES.DUPLICATE));
});
});
6 changes: 3 additions & 3 deletions test/domain/image/create.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,22 @@ describe('domain/image/create', () =>
it('should fail to create an image with an invalid data url', async () =>
{
const promise = create('test', DATA_URLS.INVALID_FORMAT);
expect(promise).rejects.toStrictEqual(new InvalidDataURL());
await expect(promise).rejects.toStrictEqual(new InvalidDataURL());
});

it('should fail to create an image with an invalid type', async () =>
{
const messages = new Map([['mimeType', 'Invalid mime type']]);

const promise = create('test', DATA_URLS.INVALID_TYPE);
expect(promise).rejects.toStrictEqual(new InvalidImage(messages));
await expect(promise).rejects.toStrictEqual(new InvalidImage(messages));
});

it('should fail to create an image that is to small', async () =>
{
const messages = new Map([['size', 'Invalid size']]);

const promise = create('test', DATA_URLS.INVALID_SIZE);
expect(promise).rejects.toStrictEqual(new InvalidImage(messages));
await expect(promise).rejects.toStrictEqual(new InvalidImage(messages));
});
});
6 changes: 3 additions & 3 deletions test/domain/rating/update.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@ describe('domain/rating/update', () =>
{
const promise = update(REQUESTERS.CREATOR, VALUES.IDS.POST_EMPTY, VALUES.IDS.REACTION_EMPTY);

expect(promise).rejects.toThrow(InvalidRating);
await expect(promise).rejects.toThrow(InvalidRating);
});

it('should not toggle without invalid post id', async () =>
{
const promise = update(REQUESTERS.CREATOR, VALUES.IDS.POST_INVALID, VALUES.IDS.REACTION_EMPTY);

expect(promise).rejects.toThrow(InvalidRating);
await expect(promise).rejects.toThrow(InvalidRating);
});

it('should not toggle without invalid comment id', async () =>
{
const promise = update(REQUESTERS.CREATOR, VALUES.IDS.POST_EMPTY, VALUES.IDS.REACTION_INVALID);

expect(promise).rejects.toThrow(InvalidRating);
await expect(promise).rejects.toThrow(InvalidRating);
});
});
2 changes: 1 addition & 1 deletion test/domain/relation/establish.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe('domain/relation/establish', () =>
{
const promise = establish(REQUESTERS.FIRST, VALUES.IDS.CREATOR2);

expect(promise).rejects.toStrictEqual(new RelationAlreadyExists());
await expect(promise).rejects.toStrictEqual(new RelationAlreadyExists());
});

it('Should rollback created data after failure', async () =>
Expand Down
8 changes: 4 additions & 4 deletions test/integrations/database/implementation.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe('integrations/database/implementation', () =>
it('should throw an error when a record is not found', async () =>
{
const promise = database.readRecord(RECORD_TYPES.PIZZAS, VALUES.IDS.NON_EXISTING);
expect(promise).rejects.toStrictEqual(new RecordNotFound());
await expect(promise).rejects.toStrictEqual(new RecordNotFound());
});
});

Expand All @@ -49,13 +49,13 @@ describe('integrations/database/implementation', () =>
await database.deleteRecord(RECORD_TYPES.FRUITS, id);

const promise = database.readRecord(RECORD_TYPES.FRUITS, id);
expect(promise).rejects.toStrictEqual(new RecordNotFound());
await expect(promise).rejects.toStrictEqual(new RecordNotFound());
});

it('should throw an error when the record cannot be deleted', async () =>
{
const promise = database.deleteRecord(RECORD_TYPES.PIZZAS, VALUES.IDS.NON_EXISTING);
expect(promise).rejects.toStrictEqual(new RecordNotFound());
await expect(promise).rejects.toStrictEqual(new RecordNotFound());
});
});

Expand All @@ -74,7 +74,7 @@ describe('integrations/database/implementation', () =>
it('should throw an error when record cannot be updated', async () =>
{
const promise = database.updateRecord(RECORD_TYPES.FRUITS, VALUES.IDS.NON_EXISTING, {});
expect(promise).rejects.toStrictEqual(new RecordNotUpdated());
await expect(promise).rejects.toStrictEqual(new RecordNotUpdated());
});
});

Expand Down
6 changes: 3 additions & 3 deletions test/integrations/filestorage/implementation.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe('integrations/filestore/implementation', () =>
it('should not read non-existing files', async () =>
{
const promise = fileStore.readFile(VALUES.FILENAMES.UNKNOWN);
expect(promise).rejects.toStrictEqual(new FileNotFound(VALUES.FILENAMES.UNKNOWN));
await expect(promise).rejects.toStrictEqual(new FileNotFound(VALUES.FILENAMES.UNKNOWN));
});
});

Expand Down Expand Up @@ -68,13 +68,13 @@ describe('integrations/filestore/implementation', () =>
await fileStore.deleteFile(VALUES.FILENAMES.HELLO);

const promise = fileStore.readFile(VALUES.FILENAMES.HELLO);
expect(promise).rejects.toStrictEqual(new FileNotFound(VALUES.FILENAMES.HELLO));
await expect(promise).rejects.toStrictEqual(new FileNotFound(VALUES.FILENAMES.HELLO));
});

it('should not delete non-existing files', async () =>
{
const promise = fileStore.deleteFile(VALUES.FILENAMES.UNKNOWN);
expect(promise).rejects.toStrictEqual(new FileNotFound(VALUES.FILENAMES.UNKNOWN));
await expect(promise).rejects.toStrictEqual(new FileNotFound(VALUES.FILENAMES.UNKNOWN));
});
});
});
4 changes: 2 additions & 2 deletions test/integrations/notification/implementation.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describe('integrations/notification/implementation', () =>
it('should not remove a non-existing subscription', async () =>
{
const promise = notificationService.unsubscribe(VALUES.RECIPIENTS.UNKNOWN);
expect(promise).rejects.toStrictEqual(new SubscriptionNotFound(VALUES.RECIPIENTS.UNKNOWN));
await expect(promise).rejects.toStrictEqual(new SubscriptionNotFound(VALUES.RECIPIENTS.UNKNOWN));
});
});

Expand All @@ -65,7 +65,7 @@ describe('integrations/notification/implementation', () =>
it('should not send a notification to a non-existing subscription', async () =>
{
const promise = notificationService.sendNotification(VALUES.RECIPIENTS.UNKNOWN, VALUES.NOTIFICATION.TITLE, VALUES.NOTIFICATION.BODY);
expect(promise).rejects.toStrictEqual(new SubscriptionNotFound(VALUES.RECIPIENTS.UNKNOWN));
await expect(promise).rejects.toStrictEqual(new SubscriptionNotFound(VALUES.RECIPIENTS.UNKNOWN));
});
});
});
Loading