mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-13 14:44:43 -04:00
Rename getNoteContentByNote to getNoteContent
Signed-off-by: Yannick Bungers <git@innay.de>
This commit is contained in:
parent
8ec756afb4
commit
8b75867664
4 changed files with 8 additions and 8 deletions
|
@ -176,7 +176,7 @@ export class NotesController {
|
||||||
if (!this.permissionsService.mayRead(req.user, note)) {
|
if (!this.permissionsService.mayRead(req.user, note)) {
|
||||||
throw new UnauthorizedException('Reading note denied!');
|
throw new UnauthorizedException('Reading note denied!');
|
||||||
}
|
}
|
||||||
return await this.noteService.getNoteContentByNote(note);
|
return await this.noteService.getNoteContent(note);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e instanceof NotInDBError) {
|
if (e instanceof NotInDBError) {
|
||||||
throw new NotFoundException(e.message);
|
throw new NotFoundException(e.message);
|
||||||
|
|
|
@ -180,7 +180,7 @@ describe('NotesService', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('getNoteContentByNote', () => {
|
describe('getNoteContent', () => {
|
||||||
it('works', async () => {
|
it('works', async () => {
|
||||||
const content = 'testContent';
|
const content = 'testContent';
|
||||||
jest
|
jest
|
||||||
|
@ -189,7 +189,7 @@ describe('NotesService', () => {
|
||||||
const newNote = await service.createNote(content);
|
const newNote = await service.createNote(content);
|
||||||
const revisions = await newNote.revisions;
|
const revisions = await newNote.revisions;
|
||||||
jest.spyOn(revisionRepo, 'findOne').mockResolvedValueOnce(revisions[0]);
|
jest.spyOn(revisionRepo, 'findOne').mockResolvedValueOnce(revisions[0]);
|
||||||
service.getNoteContentByNote(newNote).then((result) => {
|
service.getNoteContent(newNote).then((result) => {
|
||||||
expect(result).toEqual(content);
|
expect(result).toEqual(content);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -112,7 +112,7 @@ export class NotesService {
|
||||||
* @param {Note} note - the note to use
|
* @param {Note} note - the note to use
|
||||||
* @return {string} the content of the note
|
* @return {string} the content of the note
|
||||||
*/
|
*/
|
||||||
async getNoteContentByNote(note: Note): Promise<string> {
|
async getNoteContent(note: Note): Promise<string> {
|
||||||
return (await this.getLatestRevision(note)).content;
|
return (await this.getLatestRevision(note)).content;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -349,7 +349,7 @@ export class NotesService {
|
||||||
*/
|
*/
|
||||||
async toNoteDto(note: Note): Promise<NoteDto> {
|
async toNoteDto(note: Note): Promise<NoteDto> {
|
||||||
return {
|
return {
|
||||||
content: await this.getNoteContentByNote(note),
|
content: await this.getNoteContent(note),
|
||||||
metadata: await this.toNoteMetadataDto(note),
|
metadata: await this.toNoteMetadataDto(note),
|
||||||
editedByAtPosition: [],
|
editedByAtPosition: [],
|
||||||
};
|
};
|
||||||
|
|
|
@ -74,7 +74,7 @@ describe('Notes', () => {
|
||||||
.expect(201);
|
.expect(201);
|
||||||
expect(response.body.metadata?.id).toBeDefined();
|
expect(response.body.metadata?.id).toBeDefined();
|
||||||
expect(
|
expect(
|
||||||
await notesService.getNoteContentByNote(
|
await notesService.getNoteContent(
|
||||||
await notesService.getNoteByIdOrAlias(response.body.metadata.id),
|
await notesService.getNoteByIdOrAlias(response.body.metadata.id),
|
||||||
),
|
),
|
||||||
).toEqual(content);
|
).toEqual(content);
|
||||||
|
@ -109,7 +109,7 @@ describe('Notes', () => {
|
||||||
.expect(201);
|
.expect(201);
|
||||||
expect(response.body.metadata?.id).toBeDefined();
|
expect(response.body.metadata?.id).toBeDefined();
|
||||||
return expect(
|
return expect(
|
||||||
await notesService.getNoteContentByNote(
|
await notesService.getNoteContent(
|
||||||
await notesService.getNoteByIdOrAlias(response.body.metadata?.id),
|
await notesService.getNoteByIdOrAlias(response.body.metadata?.id),
|
||||||
),
|
),
|
||||||
).toEqual(content);
|
).toEqual(content);
|
||||||
|
@ -150,7 +150,7 @@ describe('Notes', () => {
|
||||||
.send(changedContent)
|
.send(changedContent)
|
||||||
.expect(200);
|
.expect(200);
|
||||||
await expect(
|
await expect(
|
||||||
await notesService.getNoteContentByNote(
|
await notesService.getNoteContent(
|
||||||
await notesService.getNoteByIdOrAlias('test4'),
|
await notesService.getNoteByIdOrAlias('test4'),
|
||||||
),
|
),
|
||||||
).toEqual(changedContent);
|
).toEqual(changedContent);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue