feat: Admin Area General Settings and Categories 1.07
This commit is contained in:
@@ -73,4 +73,22 @@ describe('Migrations', () => {
|
||||
const restrict = fks.filter((f: any) => f.on_delete === 'RESTRICT');
|
||||
expect(restrict.length).toBeGreaterThanOrEqual(2);
|
||||
});
|
||||
|
||||
it('creates the category table with created_at and updated_at columns (Job 889)', async () => {
|
||||
const cols: any[] = await dataSource.query(`PRAGMA table_info("category")`);
|
||||
const names = new Set(cols.map((c: any) => c.name));
|
||||
expect(names.has('created_at')).toBe(true);
|
||||
expect(names.has('updated_at')).toBe(true);
|
||||
});
|
||||
|
||||
it('lists categories without a "no such column: c.created_at" error (Job 889)', async () => {
|
||||
const rows = await dataSource
|
||||
.getRepository(CategoryEntity)
|
||||
.createQueryBuilder('c')
|
||||
.orderBy('LOWER(c.abbreviation)', 'ASC')
|
||||
.addOrderBy('c.abbreviation', 'ASC')
|
||||
.getMany();
|
||||
expect(Array.isArray(rows)).toBe(true);
|
||||
expect(rows.length).toBeGreaterThanOrEqual(6);
|
||||
});
|
||||
});
|
||||
@@ -2,6 +2,7 @@ import {
|
||||
datetimeMessage,
|
||||
deriveEventState,
|
||||
endAfterStartValidator,
|
||||
eventEndFieldMessage,
|
||||
isoDatetimeValidator,
|
||||
normalizePageTitle,
|
||||
pageTitleError,
|
||||
@@ -203,3 +204,22 @@ describe('datetimeMessage', () => {
|
||||
expect(datetimeMessage('Event start', '2026-08-15T10:30:00.000Z', null)).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe('eventEndFieldMessage (Job 889)', () => {
|
||||
const endIsoMsg = 'Event end must be a valid ISO-8601 datetime.';
|
||||
const endBeforeMsg = 'Event end must be after event start.';
|
||||
|
||||
it('returns the ISO message when invalidDatetime is set, even if endBeforeStart is also set', () => {
|
||||
expect(eventEndFieldMessage({ invalidDatetime: true }, { endBeforeStart: true })).toBe(endIsoMsg);
|
||||
});
|
||||
|
||||
it('returns the end-before-start message when invalidDatetime is absent and endBeforeStart is set', () => {
|
||||
expect(eventEndFieldMessage(null, { endBeforeStart: true })).toBe(endBeforeMsg);
|
||||
expect(eventEndFieldMessage({}, { endBeforeStart: true })).toBe(endBeforeMsg);
|
||||
});
|
||||
|
||||
it('returns null when both error sources are absent', () => {
|
||||
expect(eventEndFieldMessage(null, null)).toBeNull();
|
||||
expect(eventEndFieldMessage({}, {})).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user