chore: remove MongoDB service, packages and transfer tooling (MITHOME-136)
The staging site runs on PostgreSQL since 2026-09-29. Drop the mongodb compose service/volume, the mongodb/mongoose/@payloadcms/db-mongodb packages, the one-off transfer script and its helpers, the mongodump block in deploy.sh and the Mongo jest mock. Docs updated. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
b3b0347787
commit
e14a987bf3
@@ -2,43 +2,6 @@
|
||||
|
||||
// JEST MOCKS - must be set up before importing any modules that use them
|
||||
|
||||
// Mock MongoDB - fix MongoClient to work properly
|
||||
const mockAdmin = {
|
||||
ping: jest.fn().mockResolvedValue({ ok: 1 })
|
||||
}
|
||||
|
||||
const mockDb = {
|
||||
collection: jest.fn().mockReturnValue({
|
||||
findOne: jest.fn().mockResolvedValue(null),
|
||||
replaceOne: jest.fn().mockResolvedValue({ acknowledged: true }),
|
||||
find: jest.fn(() => ({
|
||||
toArray: jest.fn().mockResolvedValue([])
|
||||
})),
|
||||
insertOne: jest.fn().mockResolvedValue({ acknowledged: true, insertedId: 'test-id' }),
|
||||
insertMany: jest.fn().mockResolvedValue({ acknowledged: true, insertedIds: { 0: 'test-id' } }),
|
||||
updateOne: jest.fn().mockResolvedValue({ acknowledged: true, matchedCount: 1, modifiedCount: 1 }),
|
||||
updateMany: jest.fn().mockResolvedValue({ acknowledged: true, matchedCount: 2, modifiedCount: 2 }),
|
||||
deleteOne: jest.fn().mockResolvedValue({ acknowledged: true, deletedCount: 1 }),
|
||||
deleteMany: jest.fn().mockResolvedValue({ acknowledged: true, deletedCount: 2 }),
|
||||
bulkWrite: jest.fn().mockResolvedValue({ acknowledged: true, insertedCount: 0, matchedCount: 0, modifiedCount: 0, deletedCount: 0, upsertedCount: 0, upsertedIds: {} })
|
||||
}),
|
||||
admin: jest.fn().mockReturnValue(mockAdmin)
|
||||
}
|
||||
|
||||
const mockClient = {
|
||||
connect: jest.fn().mockResolvedValue({}),
|
||||
close: jest.fn().mockResolvedValue(undefined),
|
||||
db: jest.fn().mockImplementation((dbName) => mockDb)
|
||||
}
|
||||
|
||||
jest.mock('mongodb', () => ({
|
||||
MongoClient: jest.fn().mockImplementation(() => mockClient)
|
||||
}))
|
||||
|
||||
// Mock environment variables for tests
|
||||
process.env.MONGODB_URI = 'mongodb://localhost:27017/test'
|
||||
process.env.MONGODB_DB = 'test'
|
||||
|
||||
// Mock Winston logger - will be overridden by individual test files if needed
|
||||
jest.mock('winston', () => ({
|
||||
transports: {
|
||||
@@ -250,8 +213,6 @@ global.NextResponse = {
|
||||
}
|
||||
|
||||
// Set up environment variables for tests
|
||||
process.env.MONGODB_URI = 'mongodb://localhost:27017/test'
|
||||
process.env.MONGODB_DB = 'test'
|
||||
process.env.NODE_ENV = 'test'
|
||||
process.env.NEXT_PUBLIC_CONTACT_EMAIL = 'info@mozdit.hu'
|
||||
process.env.NEXT_PUBLIC_SITE_URL = 'https://localhost:3000'
|
||||
|
||||
Reference in New Issue
Block a user