Fixed unit tests.
All checks were successful
farmcontrol/farmcontrol-api/pipeline/head This commit looks good
All checks were successful
farmcontrol/farmcontrol-api/pipeline/head This commit looks good
This commit is contained in:
parent
a9c4b29f9f
commit
44841dd5b8
@ -10,12 +10,18 @@ jest.unstable_mockModule('../../../database/database.js', () => ({
|
|||||||
recursivelyDeleteChildObjects: jest.fn(),
|
recursivelyDeleteChildObjects: jest.fn(),
|
||||||
getModelStats: jest.fn(),
|
getModelStats: jest.fn(),
|
||||||
getModelHistory: jest.fn(),
|
getModelHistory: jest.fn(),
|
||||||
|
aggregateRollups: jest.fn(),
|
||||||
|
aggregateRollupsHistory: jest.fn(),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
jest.unstable_mockModule('../../../database/schemas/misc/note.schema.js', () => ({
|
jest.unstable_mockModule('../../../database/schemas/misc/note.schema.js', () => ({
|
||||||
noteModel: { modelName: 'Note' },
|
noteModel: { modelName: 'Note' },
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
jest.unstable_mockModule('../../../utils.js', () => ({
|
||||||
|
newNoteNotification: jest.fn(),
|
||||||
|
}));
|
||||||
|
|
||||||
jest.unstable_mockModule('log4js', () => ({
|
jest.unstable_mockModule('log4js', () => ({
|
||||||
default: {
|
default: {
|
||||||
getLogger: () => ({
|
getLogger: () => ({
|
||||||
@ -71,7 +77,12 @@ describe('Note Service Route Handlers', () => {
|
|||||||
|
|
||||||
describe('newNoteRouteHandler', () => {
|
describe('newNoteRouteHandler', () => {
|
||||||
it('should create a new note', async () => {
|
it('should create a new note', async () => {
|
||||||
req.body = { content: 'New note', noteType: 'type123' };
|
req.body = {
|
||||||
|
content: 'New note',
|
||||||
|
noteType: 'type123',
|
||||||
|
parent: 'parent123',
|
||||||
|
parentType: 'job',
|
||||||
|
};
|
||||||
const mockNote = { _id: '456', ...req.body };
|
const mockNote = { _id: '456', ...req.body };
|
||||||
newObject.mockResolvedValue(mockNote);
|
newObject.mockResolvedValue(mockNote);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user