fix bootstrapping of test data
Some checks failed
Server Tests / Mocha – Unit & Utility Tests (push) Successful in 48s
Server Tests / Jest – Integration Tests (push) Failing after 1m20s

This commit is contained in:
Devin Major 2026-04-29 13:24:33 -04:00
parent 365292dac1
commit 4dad304f86

View File

@ -16,6 +16,34 @@ if (!process.env.TOKEN_SECRET) {
process.env.TOKEN_SECRET = 'test-secret-not-for-production';
}
const mailerMock = {
agmMailSig: ['Best,', 'AgMision Team'],
sendTestMail: jest.fn(async () => ({})),
sendMail: jest.fn(async () => ({})),
sendTextMail: jest.fn(async () => ({})),
sendAdminNotification: jest.fn(async () => ({})),
sendUpdatePaymentEmail: jest.fn(async () => ({})),
sendUpdateBillingAddressEmail: jest.fn(async () => ({})),
sendCurSubcriptionsEmail: jest.fn(async () => ({})),
sendSubTrialEndingRemindEmail: jest.fn(async () => ({})),
sendSubRenewalRemindEmail: jest.fn(async () => ({})),
sendTempCredential: jest.fn(async () => ({})),
sendPasswordResetEmail: jest.fn(async () => ({})),
sendResetPasswordEmail: jest.fn(async () => ({})),
validateEmailDelivery: jest.fn(async () => true),
sendEmailVerificationCode: jest.fn(async () => ({})),
sendWelcomeNewAccEmail: jest.fn(async () => ({})),
sendPromoExpiredEmail: jest.fn(async () => ({})),
withBaseUrl: jest.fn((value) => value),
};
jest.doMock(require.resolve('../../helpers/mailer'), () => mailerMock);
jest.mock('error-handler', () => ({
errorHandler: {
mailErrorToAdmin: jest.fn(async () => ({})),
},
}), { virtual: true });
const { MongoMemoryServer } = require('mongodb-memory-server');
const mongoose = require('mongoose');
@ -44,6 +72,7 @@ async function connectDB() {
const uri = mongod.getUri();
mongoose.set('strictPopulate', false);
mongoose.set('strictQuery', false);
await mongoose.connect(uri, {
connectTimeoutMS: 15000,
socketTimeoutMS: 30000,