0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-20 22:42:53 -05:00

Increased snippets core code coverage to 100%

This commit is contained in:
Fabien "egg" O'Carroll 2023-12-14 17:14:15 +07:00
parent e88c9f7c5e
commit abf2f820cf
2 changed files with 19 additions and 5 deletions

View file

@ -18,7 +18,9 @@ describe('SnippetService', () => {
assert(allSnippets[0].name === snippet.name);
const updated = await service.update(snippet.id, {
name: 'Updated Name'
name: 'Updated Name',
lexical: '{}',
mobiledoc: '{}'
});
assert(updated);
@ -30,10 +32,22 @@ describe('SnippetService', () => {
assert(pageOfSnippets.data[0].name === updated.name);
await service.delete(snippet.id);
const deleted = await service.delete(snippet.id);
assert(deleted);
const cannotDelete = await service.delete(deleted.id);
assert(!cannotDelete);
const cannotUpdate = await service.update(deleted.id, {
name: 'Updated Again'
});
assert(!cannotUpdate);
const notFound = await service.getOne(snippet.id);
assert(notFound === null);
assert(!notFound);
});
});

View file

@ -66,8 +66,8 @@ export class SnippetsService {
async getPage(options: {filter?: string, page: number, limit: number}) {
const filter = options.filter;
const page = options.page || 1;
const limit = options.limit || 15;
const page = options.page;
const limit = options.limit;
const data = await this.repository.getSome({
count: limit,