- Replace 4x expect(true).toBe(true) in audit-logger.test.ts with
applyAuditConfig() + app.getVersion call count assertions
- Replace if(!hasCredentials){return} pattern with it.skipIf() in
3 integration test files (cleaner, erp-auth, extractor) so Vitest
correctly reports 12 tests as "skipped" instead of "passed"
- Remove placeholder assertion from skipped update-service test
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
45 lines
1.3 KiB
TypeScript
45 lines
1.3 KiB
TypeScript
import { describe, it, expect, beforeAll, afterAll } from 'vitest'
|
|
import { ErpAuthService } from '../../src/main/services/erp/erp-auth'
|
|
import type { ErpConfig } from '../../src/main/types/erp.types'
|
|
|
|
describe('ERP Authentication Service (Integration)', () => {
|
|
let authService: ErpAuthService
|
|
// For integration tests, use fixed test credentials or configure via config.yaml
|
|
const config: ErpConfig = {
|
|
url: '',
|
|
username: '',
|
|
password: ''
|
|
}
|
|
|
|
// Check if we have ERP credentials
|
|
const hasCredentials = !!(config.url && config.username && config.password)
|
|
|
|
beforeAll(() => {
|
|
if (!hasCredentials) return
|
|
authService = new ErpAuthService(config)
|
|
})
|
|
|
|
it.skipIf(!hasCredentials)('should login successfully', async () => {
|
|
const session = await authService.login()
|
|
|
|
expect(session).toBeDefined()
|
|
expect(session.browser).toBeDefined()
|
|
expect(session.context).toBeDefined()
|
|
expect(session.page).toBeDefined()
|
|
expect(session.isLoggedIn).toBe(true)
|
|
}, 30000)
|
|
|
|
it.skipIf(!hasCredentials)('should navigate to main page after login', async () => {
|
|
const session = await authService.login()
|
|
|
|
const url = session.page.url()
|
|
expect(url).toContain(config.url)
|
|
}, 30000)
|
|
|
|
afterAll(async () => {
|
|
if (hasCredentials && authService) {
|
|
await authService.close()
|
|
}
|
|
})
|
|
})
|