Format the shared package and drop an unused import to satisfy the lint gate

The i18n and schema changes added code that wasn't prettier-formatted, and place.schema.ts imported categorySchema without using it. Run prettier over shared and remove the import so 'npm run lint' + 'format:check' pass.
This commit is contained in:
Maurice
2026-05-31 20:22:54 +02:00
parent 64bd0de7e8
commit fb36ae5678
50 changed files with 1131 additions and 378 deletions
@@ -1,4 +1,3 @@
import { describe, it, expect } from 'vitest';
import {
preferencesUpdateRequestSchema,
notificationRespondRequestSchema,
@@ -6,31 +5,55 @@ import {
inAppListResultSchema,
} from './notification.schema';
import { describe, it, expect } from 'vitest';
describe('preferencesUpdateRequestSchema', () => {
it('accepts a nested event/channel/enabled matrix', () => {
expect(preferencesUpdateRequestSchema.safeParse({ trip_invite: { inapp: true, email: false } }).success).toBe(true);
expect(preferencesUpdateRequestSchema.safeParse({ trip_invite: { inapp: 'yes' } }).success).toBe(false);
expect(
preferencesUpdateRequestSchema.safeParse({
trip_invite: { inapp: true, email: false },
}).success,
).toBe(true);
expect(
preferencesUpdateRequestSchema.safeParse({
trip_invite: { inapp: 'yes' },
}).success,
).toBe(false);
});
});
describe('notificationRespondRequestSchema', () => {
it('only accepts positive/negative', () => {
expect(notificationRespondRequestSchema.safeParse({ response: 'positive' }).success).toBe(true);
expect(notificationRespondRequestSchema.safeParse({ response: 'maybe' }).success).toBe(false);
expect(
notificationRespondRequestSchema.safeParse({ response: 'positive' })
.success,
).toBe(true);
expect(
notificationRespondRequestSchema.safeParse({ response: 'maybe' }).success,
).toBe(false);
});
});
describe('channelTestResultSchema', () => {
it('accepts a success result and an error result', () => {
expect(channelTestResultSchema.safeParse({ success: true }).success).toBe(true);
expect(channelTestResultSchema.safeParse({ success: false, error: 'SMTP down' }).success).toBe(true);
expect(channelTestResultSchema.safeParse({ success: true }).success).toBe(
true,
);
expect(
channelTestResultSchema.safeParse({ success: false, error: 'SMTP down' })
.success,
).toBe(true);
});
});
describe('inAppListResultSchema', () => {
it('accepts the list envelope with open notification rows', () => {
expect(inAppListResultSchema.safeParse({
notifications: [{ id: 1, type: 'info', anything: 'goes' }], total: 1, unread_count: 0,
}).success).toBe(true);
expect(
inAppListResultSchema.safeParse({
notifications: [{ id: 1, type: 'info', anything: 'goes' }],
total: 1,
unread_count: 0,
}).success,
).toBe(true);
});
});
@@ -18,10 +18,14 @@ export const preferencesUpdateRequestSchema = z.record(
z.string(),
z.record(z.string(), z.boolean()),
);
export type PreferencesUpdateRequest = z.infer<typeof preferencesUpdateRequestSchema>;
export type PreferencesUpdateRequest = z.infer<
typeof preferencesUpdateRequestSchema
>;
export const testSmtpRequestSchema = z.object({ email: z.string().optional() });
export const testWebhookRequestSchema = z.object({ url: z.string().optional() });
export const testWebhookRequestSchema = z.object({
url: z.string().optional(),
});
export const testNtfyRequestSchema = z.object({
topic: z.string().optional(),
server: z.string().optional(),
@@ -39,7 +43,9 @@ export type ChannelTestResult = z.infer<typeof channelTestResultSchema>;
export const notificationRespondRequestSchema = z.object({
response: z.enum(['positive', 'negative']),
});
export type NotificationRespondRequest = z.infer<typeof notificationRespondRequestSchema>;
export type NotificationRespondRequest = z.infer<
typeof notificationRespondRequestSchema
>;
/** A single in-app notification row (DB-shaped; kept open). */
export const notificationRowSchema = z.record(z.string(), z.unknown());