fix bootstrapping of test data
This commit is contained in:
parent
365292dac1
commit
4dad304f86
@ -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,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user