mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-08 20:23:39 +00:00
Clean up tests
This commit is contained in:
@@ -61,7 +61,7 @@ pre {
|
|||||||
## changelog
|
## changelog
|
||||||
For a full record of development, visit our [Github Page](https://github.com/naturalcrit/homebrewery).
|
For a full record of development, visit our [Github Page](https://github.com/naturalcrit/homebrewery).
|
||||||
|
|
||||||
### Friday 17/02/2023 - v3.6.1
|
### Saturday 18/02/2023 - v3.6.1
|
||||||
{{taskList
|
{{taskList
|
||||||
##### G-Ambatte
|
##### G-Ambatte
|
||||||
|
|
||||||
|
|||||||
@@ -317,13 +317,7 @@ If you believe you should have access to this brew, ask the file owner to invite
|
|||||||
brew.textBin = zlib.deflateRawSync(brew.text);
|
brew.textBin = zlib.deflateRawSync(brew.text);
|
||||||
brew.text = undefined;
|
brew.text = undefined;
|
||||||
}
|
}
|
||||||
|
brew.markModified('authors'); //Mongo will not properly update arrays without markModified()
|
||||||
// Otherwise, save the brew with updated author list
|
|
||||||
// markModified() is necessary to have Mongoose reduce the array length in the database
|
|
||||||
// Without it, starting with an array of ['A', 'B', 'C'] in the database:
|
|
||||||
// - when reduced to ['A', 'B'] will result in ['A', 'B', 'C'] saved in the database
|
|
||||||
// - when reduced to ['B', 'C'] will result in ['B', 'C', 'C'] saved in the database
|
|
||||||
brew.markModified('authors');
|
|
||||||
await brew.save()
|
await brew.save()
|
||||||
.catch((err)=>{
|
.catch((err)=>{
|
||||||
throw { status: 500, message: err };
|
throw { status: 500, message: err };
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ describe('Tests for api', ()=>{
|
|||||||
delete this.save;
|
delete this.save;
|
||||||
delete this.toObject;
|
delete this.toObject;
|
||||||
delete this.remove;
|
delete this.remove;
|
||||||
|
delete this.markModified;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -444,7 +445,6 @@ brew`);
|
|||||||
description : '',
|
description : '',
|
||||||
editId : expect.any(String),
|
editId : expect.any(String),
|
||||||
gDrive : false,
|
gDrive : false,
|
||||||
markModified : expect.any(Function),
|
|
||||||
pageCount : 1,
|
pageCount : 1,
|
||||||
published : false,
|
published : false,
|
||||||
renderer : 'V3',
|
renderer : 'V3',
|
||||||
@@ -508,7 +508,6 @@ brew`);
|
|||||||
renderer : undefined,
|
renderer : undefined,
|
||||||
shareId : expect.any(String),
|
shareId : expect.any(String),
|
||||||
googleId : expect.any(String),
|
googleId : expect.any(String),
|
||||||
markModified : expect.any(Function),
|
|
||||||
style : undefined,
|
style : undefined,
|
||||||
systems : [],
|
systems : [],
|
||||||
tags : [],
|
tags : [],
|
||||||
@@ -722,7 +721,7 @@ brew`);
|
|||||||
await api.deleteBrew(req, res);
|
await api.deleteBrew(req, res);
|
||||||
|
|
||||||
expect(api.getBrew).toHaveBeenCalled();
|
expect(api.getBrew).toHaveBeenCalled();
|
||||||
// expect(markModifiedFunc).toHaveBeenCalled();
|
expect(markModifiedFunc).toHaveBeenCalled();
|
||||||
expect(model.findOne).toHaveBeenCalled();
|
expect(model.findOne).toHaveBeenCalled();
|
||||||
expect(removeFunc).not.toHaveBeenCalled();
|
expect(removeFunc).not.toHaveBeenCalled();
|
||||||
expect(api.deleteGoogleBrew).toHaveBeenCalled();
|
expect(api.deleteGoogleBrew).toHaveBeenCalled();
|
||||||
|
|||||||
Reference in New Issue
Block a user