Add test for behaviour around expanded state#1972
Conversation
charisk
left a comment
There was a problem hiding this comment.
Thanks for improving our test coverage! Just some small comments.
| expandedItems![0] as VariantAnalysisUserDefinedListExpandedDbItem; | ||
| expect(expandedItem.listName).toEqual(listName); | ||
|
|
||
| // Trigger adding an item that is not in the config |
There was a problem hiding this comment.
I think it would be more realistic if the test added a different item (that exists), and checked that the other one (that doesn't exist) was removed.
There was a problem hiding this comment.
(Optional) I think this is slightly confusing because there are 3 different lists at play. I would do the following:
- Have expanded state have only 1 item (the
removedVariantAnalysisList) - Trigger adding a new item in the config (the
variantAnalysisList) - Check that the expanded state no longer contains the
removedVariantAnalysisList
| }); | ||
|
|
||
| await dbManager.addDbItemToExpandedState(dbItem); | ||
| const expandedItems = await app.workspaceState.get<ExpandedDbItem[]>( |
There was a problem hiding this comment.
Does this need the await? I was under the impression it's a synchronous operation.
There was a problem hiding this comment.
I just checked and indeed this is synchronous, so we can remove the await.
There was a problem hiding this comment.
Good catch! Thanks
86c1b12 to
07868d9
Compare
norascheuch
left a comment
There was a problem hiding this comment.
Thanks @charisk , changes are pushed!
| expandedItems![0] as VariantAnalysisUserDefinedListExpandedDbItem; | ||
| expect(expandedItem.listName).toEqual(listName); | ||
|
|
||
| // Trigger adding an item that is not in the config |
charisk
left a comment
There was a problem hiding this comment.
Looks good! Just a couple of minor suggestions.
| expandedItems![0] as VariantAnalysisUserDefinedListExpandedDbItem; | ||
| expect(expandedItem.listName).toEqual(listName); | ||
|
|
||
| // Trigger adding an item that is not in the config |
There was a problem hiding this comment.
(Optional) I think this is slightly confusing because there are 3 different lists at play. I would do the following:
- Have expanded state have only 1 item (the
removedVariantAnalysisList) - Trigger adding a new item in the config (the
variantAnalysisList) - Check that the expanded state no longer contains the
removedVariantAnalysisList
| }); | ||
|
|
||
| await dbManager.addDbItemToExpandedState(dbItem); | ||
| const expandedItems = await app.workspaceState.get<ExpandedDbItem[]>( |
There was a problem hiding this comment.
I just checked and indeed this is synchronous, so we can remove the await.
Checklist
ready-for-doc-reviewlabel there.