GitHub

MockCollection

import { MockCollection } from '@daffodil/core/testing'

Mocked DaffCollection object.

It should be customized by passing the factory for the contained entity as the first constructor argument.

class MockCollection<<T extends DaffIdentifiable = DaffIdentifiable>>  implements DaffCollection<T> {
  metadata: DaffCollectionMetadata = this.createMetadata()
  data: Record<T["id"], T> = daffIdentifiableArrayToDict(this._items)
}