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:
parent
e88c9f7c5e
commit
abf2f820cf
2 changed files with 19 additions and 5 deletions
|
@ -18,7 +18,9 @@ describe('SnippetService', () => {
|
||||||
assert(allSnippets[0].name === snippet.name);
|
assert(allSnippets[0].name === snippet.name);
|
||||||
|
|
||||||
const updated = await service.update(snippet.id, {
|
const updated = await service.update(snippet.id, {
|
||||||
name: 'Updated Name'
|
name: 'Updated Name',
|
||||||
|
lexical: '{}',
|
||||||
|
mobiledoc: '{}'
|
||||||
});
|
});
|
||||||
|
|
||||||
assert(updated);
|
assert(updated);
|
||||||
|
@ -30,10 +32,22 @@ describe('SnippetService', () => {
|
||||||
|
|
||||||
assert(pageOfSnippets.data[0].name === updated.name);
|
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);
|
const notFound = await service.getOne(snippet.id);
|
||||||
|
|
||||||
assert(notFound === null);
|
assert(!notFound);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -66,8 +66,8 @@ export class SnippetsService {
|
||||||
|
|
||||||
async getPage(options: {filter?: string, page: number, limit: number}) {
|
async getPage(options: {filter?: string, page: number, limit: number}) {
|
||||||
const filter = options.filter;
|
const filter = options.filter;
|
||||||
const page = options.page || 1;
|
const page = options.page;
|
||||||
const limit = options.limit || 15;
|
const limit = options.limit;
|
||||||
|
|
||||||
const data = await this.repository.getSome({
|
const data = await this.repository.getSome({
|
||||||
count: limit,
|
count: limit,
|
||||||
|
|
Loading…
Add table
Reference in a new issue