Fixed email designs
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
// Run only against disposable local Postgres, Redis, and Mailpit services.
|
||||
// See docs/WEIGHT_REMINDER_TESTING.md for the isolated Compose setup.
|
||||
import assert from 'node:assert/strict';
|
||||
import { readFile } from 'node:fs/promises';
|
||||
import { randomUUID } from 'node:crypto';
|
||||
import { spawn } from 'node:child_process';
|
||||
import { once } from 'node:events';
|
||||
@@ -83,6 +84,8 @@ try {
|
||||
VALUES ($1, $2, $3, 'Cockatiel', CURRENT_TIMESTAMP - INTERVAL '100 hours', ${memorial ? 'CURRENT_TIMESTAMP' : 'NULL'})`, [id, workspace, name]);
|
||||
if (age !== null) await db.query("INSERT INTO weight_records (bird_id, weight_grams, recorded_on, created_at) VALUES ($1, 90, CURRENT_DATE - 3, CURRENT_TIMESTAMP - $2 * INTERVAL '1 hour')", [id, age]);
|
||||
}
|
||||
const portrait = await readFile(new URL('../assets/yoda.png', import.meta.url));
|
||||
await db.query('UPDATE birds SET photo_data_url = $1 WHERE id = $2', [`data:image/png;base64,${portrait.toString('base64')}`, birds['Kiwi & <Peep>']]);
|
||||
const due = await listDueWeightReminders();
|
||||
assert.equal(due.length, 10);
|
||||
assert.deepEqual(new Set(due.map(b => b.recipient)), new Set(['owner@example.test', 'assistant@example.test', 'caregiver@example.test']));
|
||||
@@ -113,6 +116,11 @@ try {
|
||||
assert.ok(!body.Text.includes('Boundary'));
|
||||
}
|
||||
assert.equal(body.To.length, 1);
|
||||
const inline = body.Inline ?? [];
|
||||
assert.ok(inline.some(attachment => attachment.ContentID === 'flockpal-logo'));
|
||||
assert.equal(inline.filter(attachment => attachment.ContentID.startsWith('weight-bird-')).length, body.Subject === 'Weight reminders for Test Flock' ? 3 : 1);
|
||||
assert.ok(body.HTML.includes('Daily weight reminder'));
|
||||
assert.ok(body.HTML.includes('Record their weights'));
|
||||
}
|
||||
assert.equal((await weightReminderQueue.getJobSchedulers()).length, 0);
|
||||
await poll(async () => Boolean(await weightReminderQueue.getJob(`weight-reminders-${getReminderDate()}`)), 'startup daily scheduler');
|
||||
|
||||
Reference in New Issue
Block a user