This commit is contained in:
2025-05-26 12:23:19 +00:00
parent b8ea8f660e
commit 20583beb35
5 changed files with 860 additions and 1288 deletions

View File

@ -321,5 +321,68 @@ tap.start();
### Progress Tracking
- Fixed 8 tests total (as of 2025-05-25)
- 30 error logs remaining in `.nogit/testlogs/00err/`
- Edge cases, email composition, error handling, performance, reliability, RFC compliance, and security tests still need fixes
- Fixed 8 additional tests (as of 2025-05-26):
- test.cedge-03.protocol-violations.ts
- test.cerr-03.network-failures.ts
- test.cerr-05.quota-exceeded.ts
- test.cerr-06.invalid-recipients.ts
- test.crel-01.reconnection-logic.ts
- test.crel-02.network-interruption.ts
- test.crel-03.queue-persistence.ts
- 26 error logs remaining in `.nogit/testlogs/00err/`
- Performance, additional reliability, RFC compliance, and security tests still need fixes
## Test Fix Findings (2025-05-26)
### Common Issues in SMTP Client Tests
1. **DATA Phase Handling in Test Servers**
- Test servers must properly handle DATA mode
- Need to track when in DATA mode and look for the terminating '.'
- Multi-line data must be processed line by line
```typescript
let inData = false;
socket.on('data', (data) => {
const lines = data.toString().split('\r\n');
lines.forEach(line => {
if (inData && line === '.') {
socket.write('250 OK\r\n');
inData = false;
} else if (line === 'DATA') {
socket.write('354 Send data\r\n');
inData = true;
}
});
});
```
2. **Import Issues**
- `createSmtpClient` should be imported from `ts/mail/delivery/smtpclient/index.js`
- Test server functions: use `startTestServer`/`stopTestServer` (not `startTestSmtpServer`)
- Helper exports `createTestSmtpClient`, not `createSmtpClient`
3. **SmtpClient API Misconceptions**
- SmtpClient doesn't have methods like `connect()`, `isConnected()`, `getConnectionInfo()`
- Use `verify()` for connection testing
- Use `sendMail()` with Email objects for sending
- Connection management is handled internally
4. **createSmtpClient is Not Async**
- The factory function returns an SmtpClient directly, not a Promise
- Remove `await` from `createSmtpClient()` calls
5. **Test Expectations**
- Multi-line SMTP responses may timeout if server doesn't send final line
- Mixed valid/invalid recipients might succeed for valid ones (implementation-specific)
- Network failure tests should use realistic expectations
6. **Test Runner Requirements**
- Tests using `tap` from '@git.zone/tstest/tapbundle' must call `tap.start()` at the end
- Without `tap.start()`, no tests will be detected or run
- Place `tap.start()` after all `tap.test()` definitions
7. **Connection Pooling Effects**
- SmtpClient uses connection pooling by default
- Test servers may not receive all messages immediately
- Messages might be queued and sent through different connections
- Adjust test expectations to account for pooling behavior