chore(8.0): final pre-RC1 sweep — API consistency, named errors, orphans, zero-cast codebase
This commit is contained in:
parent
970e08c466
commit
1f7e365a4e
237 changed files with 1951 additions and 49413 deletions
|
|
@ -155,7 +155,7 @@ describe('Brainy Batch Operations', () => {
|
|||
})
|
||||
})
|
||||
|
||||
describe('deleteMany - Batch Deletion', () => {
|
||||
describe('removeMany - Batch Deletion', () => {
|
||||
let testIds: string[]
|
||||
|
||||
beforeEach(async () => {
|
||||
|
|
@ -171,7 +171,7 @@ describe('Brainy Batch Operations', () => {
|
|||
})
|
||||
|
||||
it('should delete multiple entities at once', async () => {
|
||||
await brain.deleteMany({ ids: testIds })
|
||||
await brain.removeMany({ ids: testIds })
|
||||
|
||||
// All should be gone
|
||||
for (const id of testIds) {
|
||||
|
|
@ -185,7 +185,7 @@ describe('Brainy Batch Operations', () => {
|
|||
const toDelete = [testIds[0], testIds[2], testIds[4]]
|
||||
const toKeep = [testIds[1], testIds[3]]
|
||||
|
||||
await brain.deleteMany({ ids: toDelete })
|
||||
await brain.removeMany({ ids: toDelete })
|
||||
|
||||
// Deleted ones should be gone
|
||||
for (const id of toDelete) {
|
||||
|
|
@ -212,7 +212,7 @@ describe('Brainy Batch Operations', () => {
|
|||
await brain.relate({ from: person2, to: org, type: VerbType.MemberOf as any })
|
||||
|
||||
// Delete the organization
|
||||
await brain.deleteMany({ ids: [org] })
|
||||
await brain.removeMany({ ids: [org] })
|
||||
|
||||
// Organization should be gone
|
||||
const deletedOrg = await brain.get(org)
|
||||
|
|
@ -237,7 +237,7 @@ describe('Brainy Batch Operations', () => {
|
|||
const manyIds = manyResult.successful
|
||||
|
||||
const startTime = Date.now()
|
||||
await brain.deleteMany({ ids: manyIds })
|
||||
await brain.removeMany({ ids: manyIds })
|
||||
const duration = Date.now() - startTime
|
||||
|
||||
// v5.4.0: Increased to 14500ms for type-first storage + system load variance
|
||||
|
|
@ -281,7 +281,7 @@ describe('Brainy Batch Operations', () => {
|
|||
expect(relationIds).toHaveLength(3)
|
||||
|
||||
// Verify relationships exist
|
||||
const person1Relations = await brain.getRelations({ from: entities[0] })
|
||||
const person1Relations = await brain.related({ from: entities[0] })
|
||||
expect(person1Relations.length).toBeGreaterThan(0)
|
||||
})
|
||||
|
||||
|
|
@ -297,13 +297,13 @@ describe('Brainy Batch Operations', () => {
|
|||
expect(relationIds).toHaveLength(3)
|
||||
|
||||
// Verify different types
|
||||
const friendRelations = await brain.getRelations({
|
||||
const friendRelations = await brain.related({
|
||||
from: entities[0],
|
||||
type: VerbType.FriendOf
|
||||
})
|
||||
expect(friendRelations.length).toBeGreaterThan(0)
|
||||
|
||||
const workRelations = await brain.getRelations({
|
||||
const workRelations = await brain.related({
|
||||
from: entities[0],
|
||||
type: VerbType.WorksWith
|
||||
})
|
||||
|
|
@ -321,10 +321,10 @@ describe('Brainy Batch Operations', () => {
|
|||
expect(relationIds).toHaveLength(2)
|
||||
|
||||
// Both should have the relationship
|
||||
const person1Friends = await brain.getRelations({ from: entities[0] })
|
||||
const person1Friends = await brain.related({ from: entities[0] })
|
||||
expect(person1Friends.length).toBeGreaterThan(0)
|
||||
|
||||
const person2Friends = await brain.getRelations({ from: entities[1] })
|
||||
const person2Friends = await brain.related({ from: entities[1] })
|
||||
expect(person2Friends.length).toBeGreaterThan(0)
|
||||
})
|
||||
|
||||
|
|
@ -358,7 +358,7 @@ describe('Brainy Batch Operations', () => {
|
|||
expect(duration).toBeLessThan(1000) // Should be fast
|
||||
|
||||
// Verify company has all relationships
|
||||
const companyRelations = await brain.getRelations({ to: company })
|
||||
const companyRelations = await brain.related({ to: company })
|
||||
expect(companyRelations.length).toBeGreaterThanOrEqual(50)
|
||||
})
|
||||
|
||||
|
|
@ -460,7 +460,7 @@ describe('Brainy Batch Operations', () => {
|
|||
await brain.relateMany({ items: relationships })
|
||||
|
||||
// 4. Delete some entities
|
||||
await brain.deleteMany({ ids: initialIds.slice(15) })
|
||||
await brain.removeMany({ ids: initialIds.slice(15) })
|
||||
|
||||
const totalTime = Date.now() - startTime
|
||||
|
||||
|
|
@ -473,7 +473,7 @@ describe('Brainy Batch Operations', () => {
|
|||
const deleted = await brain.get(initialIds[19])
|
||||
expect(deleted).toBeNull()
|
||||
|
||||
const relations = await brain.getRelations({ from: initialIds[0] })
|
||||
const relations = await brain.related({ from: initialIds[0] })
|
||||
expect(relations.length).toBeGreaterThan(0)
|
||||
})
|
||||
})
|
||||
|
|
@ -487,7 +487,7 @@ describe('Brainy Batch Operations', () => {
|
|||
expect(result.successful).toHaveLength(0)
|
||||
|
||||
await brain.updateMany({ items: [] })
|
||||
await brain.deleteMany({ ids: [] })
|
||||
await brain.removeMany({ ids: [] })
|
||||
// Should not throw
|
||||
})
|
||||
|
||||
|
|
|
|||
Reference in a new issue