0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-02 15:02:38 +00:00

fix tests after merge from master

This commit is contained in:
Charlie Humphreys
2023-01-05 23:10:25 -06:00
parent 676acb9e5a
commit a54ebabf53

View File

@@ -1,7 +1,5 @@
/* eslint-disable max-lines */ /* eslint-disable max-lines */
describe('Tests for api', ()=>{ describe('Tests for api', ()=>{
let api; let api;
let google; let google;
@@ -170,7 +168,7 @@ describe('Tests for api', ()=>{
}); });
it('changes tags from string to array', async ()=>{ it('changes tags from string to array', async ()=>{
const testBrew = { title: 'test brew', authors: [], tags: 'tag' }; const testBrew = { title: 'test brew', authors: [], tags: '' };
api.getId = jest.fn(()=>({ id: '1', googleId: undefined })); api.getId = jest.fn(()=>({ id: '1', googleId: undefined }));
model.get = jest.fn(()=>toBrewPromise(testBrew)); model.get = jest.fn(()=>toBrewPromise(testBrew));
@@ -248,17 +246,22 @@ If you believe you should have access to this brew, ask the file owner to invite
text : 'brew text', text : 'brew text',
stubbed : true, stubbed : true,
description : '', description : '',
editId : null, editId : undefined,
pageCount : 1, pageCount : 1,
published : true, published : false,
renderer : 'legacy', renderer : 'legacy',
shareId : null, shareId : undefined,
systems : [], systems : [],
tags : [], tags : [],
theme : '5ePHB', theme : '5ePHB',
thumbnail : '', thumbnail : '',
textBin : undefined, textBin : undefined,
version : undefined version : undefined,
createdAt : undefined,
gDrive : false,
style : undefined,
trashed : false,
updatedAt : undefined
}); });
expect(next).toHaveBeenCalled(); expect(next).toHaveBeenCalled();
expect(api.getId).toHaveBeenCalledWith(req); expect(api.getId).toHaveBeenCalledWith(req);
@@ -433,21 +436,26 @@ brew`);
expect(res.status).toHaveBeenCalledWith(200); expect(res.status).toHaveBeenCalledWith(200);
expect(res.send).toHaveBeenCalledWith({ expect(res.send).toHaveBeenCalledWith({
_id : '1', _id : '1',
authors : ['test user'], authors : ['test user'],
description : '', createdAt : undefined,
editId : expect.any(String), description : '',
pageCount : 1, editId : expect.any(String),
published : false, gDrive : false,
renderer : 'V3', pageCount : 1,
shareId : expect.any(String), published : false,
systems : [], renderer : 'V3',
tags : [], shareId : expect.any(String),
text : undefined, style : undefined,
textBin : expect.objectContaining({}), systems : [],
theme : '5ePHB', tags : [],
thumbnail : '', text : undefined,
title : 'asdf', textBin : expect.objectContaining({}),
theme : '5ePHB',
thumbnail : '',
title : 'asdf',
trashed : false,
updatedAt : undefined
}); });
}); });
@@ -487,13 +495,16 @@ brew`);
expect(res.send).toHaveBeenCalledWith({ expect(res.send).toHaveBeenCalledWith({
_id : '1', _id : '1',
authors : ['test user'], authors : ['test user'],
createdAt : undefined,
description : '', description : '',
editId : expect.any(String), editId : expect.any(String),
gDrive : false,
pageCount : undefined, pageCount : undefined,
published : false, published : false,
renderer : undefined, renderer : undefined,
shareId : expect.any(String), shareId : expect.any(String),
googleId : expect.any(String), googleId : expect.any(String),
style : undefined,
systems : [], systems : [],
tags : [], tags : [],
text : undefined, text : undefined,
@@ -501,6 +512,8 @@ brew`);
theme : '5ePHB', theme : '5ePHB',
thumbnail : '', thumbnail : '',
title : 'asdf', title : 'asdf',
trashed : false,
updatedAt : undefined
}); });
}); });