Skip to content

Instantly share code, notes, and snippets.

@YonatanKra
Created September 3, 2023 18:04
Show Gist options
  • Save YonatanKra/732ab9ffbbfc50da6bb6d887d9a24240 to your computer and use it in GitHub Desktop.
Save YonatanKra/732ab9ffbbfc50da6bb6d887d9a24240 to your computer and use it in GitHub Desktop.
Tauri-demo refactored first test
it('should set the greeting message inside the message element', async () => {
setupDomElements();
window.dispatchEvent(new Event("DOMContentLoaded"));
const name = 'John Doe';
const { greetForm, greetMsgEl } = getElementsAndSetInputValue(name);
mockIPC((cmd, args) => {
if(cmd === "greet") {
return `Hello, ${args.name}! You've been greeted from Rust!`;
}
});
await dispatchFormSubmit(greetForm);
expect(greetMsgEl?.textContent).toBe(`Hello, ${name}! You've been greeted from Rust!`);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment