Skip to content

Commit

Permalink
Moved smtp test config into global mock config
Browse files Browse the repository at this point in the history
  • Loading branch information
ARADDCC012 committed Nov 29, 2024
1 parent d15fe16 commit 0546f95
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 65 deletions.
13 changes: 13 additions & 0 deletions backend/src/utils/__mocks__/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,19 @@ const config: PartialDeep<Config> = {
kinds: [],
},
},
smtp: {
enabled: true,
connection: {
host: 'localhost',
port: 1025,
secure: false,
auth: undefined,
tls: {
rejectUnauthorized: false,
},
},
from: '"Bailo 📝" <bailo@example.org>',
},
log: {
level: 'debug',
},
Expand Down
65 changes: 0 additions & 65 deletions backend/test/services/smtp/smtp.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,71 +11,6 @@ import {
} from '../../../src/services/smtp/smtp.js'
import config from '../../../src/utils/config.js'
import { testReviewResponse } from '../../testUtils/testModels.js'
// type AuthenticationKindKeys = (typeof AuthenticationKind)[keyof typeof AuthenticationKind]
vi.mock('../../../src/utils/config.js', () => {
return {
__esModule: true,
default: {
app: {
protocol: '',
host: '',
port: 3000,
},

connectors: {
authorisation: {
kind: 'basic',
},
fileScanners: {
kinds: ['clamAV'],
},
audit: {
kind: 'silly',
},
},

avScanning: {
clamdscan: {
host: '127.0.0.1',
port: 8080,
},

modelscan: {
protocol: 'http',
host: '127.0.0.1',
port: 8081,
},
},
s3: {
buckets: {
uploads: 'uploads',
registry: 'registry',
},
},

registry: {
connection: {
insecure: true,
},
},
smtp: {
enabled: true,

connection: {
host: 'localhost',
port: 1025,
secure: false,
auth: undefined,
tls: {
rejectUnauthorized: false,
},
},

from: '"Bailo 📝" <bailo@example.org>',
},
},
}
})

const logMock = vi.hoisted(() => ({
info: vi.fn(),
Expand Down

0 comments on commit 0546f95

Please sign in to comment.