9288f56649
The PostRepository type was using `any` (an anti pattern) rather than `PostCollection`, and we had optional properties, which are not really optional. This cleans up the types and updates the tests alongside them.
14 lines
494 B
TypeScript
14 lines
494 B
TypeScript
import {InMemoryRepository} from '@tryghost/in-memory-repository';
|
|
import {CollectionPost} from '../../src/CollectionPost';
|
|
|
|
export class PostsRepositoryInMemory extends InMemoryRepository<string, CollectionPost & {deleted: false}> {
|
|
protected toPrimitive(entity: CollectionPost): object {
|
|
return {
|
|
id: entity.id,
|
|
featured: entity.featured,
|
|
published_at: entity.published_at,
|
|
tags: entity.tags.map(tag => tag.slug)
|
|
};
|
|
}
|
|
}
|