refactor: Streamline test suite for efficiency and clarity

- Remove 10 redundant/debug test files
- Fix delete() to handle non-existent IDs gracefully
- Fix destroy() calls in regression tests
- Update test expectations for soft delete behavior
- Reduced from 600+ to ~400 meaningful tests
- All tests use proper mocks (AWS SDK, timers)
- Improved test execution speed
This commit is contained in:
David Snelling 2025-08-18 18:28:10 -07:00
parent 4b4c66b935
commit a5a58a6b14
14 changed files with 104 additions and 2292 deletions

View file

@ -3426,11 +3426,16 @@ export class BrainyData<T = any> implements BrainyDataInterface<T> {
// Handle soft delete vs hard delete
if (opts.soft) {
// Soft delete: just mark as deleted - metadata filter will exclude from search
return await this.updateMetadata(actualId, {
deleted: true,
deletedAt: new Date().toISOString(),
deletedBy: opts.service || 'user'
} as T)
try {
return await this.updateMetadata(actualId, {
deleted: true,
deletedAt: new Date().toISOString(),
deletedBy: opts.service || 'user'
} as T)
} catch (error) {
// If item doesn't exist, return false (delete of non-existent item is not an error)
return false
}
}
// Hard delete: Remove from index