New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tests for CoversationViewModel #5225
Conversation
const viewModelObject = object<MailViewerViewModel>() | ||
// @ts-ignore | ||
viewModelObject.mail = mail | ||
//when(viewModelObject.isCollapsed()).thenReturn(false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dangling comment
} | ||
|
||
function makeMailModel(mailBoxDetail: MailboxDetail): MailModel { | ||
return downcast({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest replacing downcast
with as Partial<MailModel> as MailModel
} | ||
|
||
async function makeViewModel(pMail: Mail): Promise<void> { | ||
let factory = await viewModelFactory() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let
-> const
redraw = async () => { | ||
// defer to the end of the event loop so that viewModel has correct loading state | ||
await delay(1) | ||
console.log("redraw", "finished", viewModel.isFinished(), "offline", viewModel.isConnectionLost()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would avoid logging, it's spammy
) | ||
}) | ||
|
||
o("only one mail is shown when conversation view option is turned off", async function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rewrite most cases like "when the option is off it only shows selected mail", so like "when … then". At least I think we are trying to do it this way these days?
|
||
when( | ||
mailModel.getMailboxDetailsForMail( | ||
matchers.argThat(function (mail) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this matcher do anything? did you want to use anything()
instead?
) | ||
|
||
const numMailsDisplayed = viewModel.conversationItems().filter((i) => i.type === "mail").length | ||
o(numMailsDisplayed).equals(conversation.length)( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if just the number is enough, it might be that a wrong email is removed
No description provided.