Replace toBeDefined()/typeof checks with assertions that verify actual behavior and output content. Key changes: - locators: assert actual CSS selector values instead of existence - logger-integration: test run()/getContext()/withRequestContext() behavior - logger: verify winstonCalls content (level, message, metadata) - config-manager: test default values, singleton, and getConfig() throws - erp-auth: remove empty Class Structure block (covered by behavior tests) - audit-logger: spy on auditLogger.info to verify JSONL entry content - extractor: remove Math.ceil tests, verify error result structure Net: -209 lines of hollow/redundant test code. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
30 lines
1.3 KiB
TypeScript
30 lines
1.3 KiB
TypeScript
import { describe, it, expect } from 'vitest'
|
|
import { ERP_LOCATORS } from '../../src/main/services/erp/locators'
|
|
|
|
describe('ERP Locators', () => {
|
|
it('should have correct login page selectors', () => {
|
|
expect(ERP_LOCATORS.login.usernameInput).toBe('#username')
|
|
expect(ERP_LOCATORS.login.passwordInput).toBe('#password')
|
|
expect(ERP_LOCATORS.login.submitButton).toBe('button[type="submit"]')
|
|
})
|
|
|
|
it('should have correct main frame selectors', () => {
|
|
expect(ERP_LOCATORS.main.mainIframe).toBe('#mainiframe')
|
|
expect(ERP_LOCATORS.main.forwardFrame).toBe('#forwardFrame')
|
|
expect(ERP_LOCATORS.main.loadingText).toBe('加载中')
|
|
})
|
|
|
|
it('should have correct extractor page selectors', () => {
|
|
expect(ERP_LOCATORS.extractor.orderNumberInputRole).toBe('来源生产订单号')
|
|
expect(ERP_LOCATORS.extractor.queryButton).toBe('.search-component-searchBtn')
|
|
expect(ERP_LOCATORS.extractor.exportButton).toBe('internal:has-text="输出"')
|
|
expect(ERP_LOCATORS.extractor.confirmButton).toBe('internal:has-text="确定(Y)"')
|
|
})
|
|
|
|
it('should have correct cleaner page selectors', () => {
|
|
expect(ERP_LOCATORS.cleaner.orderNumberInput).toBe('input[name="orderNumber"]')
|
|
expect(ERP_LOCATORS.cleaner.materialGrid).toBe('table.material-grid tbody tr')
|
|
expect(ERP_LOCATORS.cleaner.saveButton).toBe('button:has-text("保存")')
|
|
})
|
|
})
|