mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-06-21 06:11:45 +00:00
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:
@@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user