0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-24 16:22:44 +00:00

Clean up tests

This commit is contained in:
Trevor Buckner
2023-02-18 13:48:02 -05:00
parent 1fb7fe2487
commit 298a10bc42
3 changed files with 4 additions and 11 deletions

View File

@@ -61,7 +61,7 @@ pre {
## changelog
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
##### G-Ambatte

View File

@@ -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.text = undefined;
}
// 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');
brew.markModified('authors'); //Mongo will not properly update arrays without markModified()
await brew.save()
.catch((err)=>{
throw { status: 500, message: err };

View File

@@ -32,6 +32,7 @@ describe('Tests for api', ()=>{
delete this.save;
delete this.toObject;
delete this.remove;
delete this.markModified;
return this;
}
});
@@ -444,7 +445,6 @@ brew`);
description : '',
editId : expect.any(String),
gDrive : false,
markModified : expect.any(Function),
pageCount : 1,
published : false,
renderer : 'V3',
@@ -508,7 +508,6 @@ brew`);
renderer : undefined,
shareId : expect.any(String),
googleId : expect.any(String),
markModified : expect.any(Function),
style : undefined,
systems : [],
tags : [],
@@ -722,7 +721,7 @@ brew`);
await api.deleteBrew(req, res);
expect(api.getBrew).toHaveBeenCalled();
// expect(markModifiedFunc).toHaveBeenCalled();
expect(markModifiedFunc).toHaveBeenCalled();
expect(model.findOne).toHaveBeenCalled();
expect(removeFunc).not.toHaveBeenCalled();
expect(api.deleteGoogleBrew).toHaveBeenCalled();