From b13b5b617022a679d93128bbee6032ea1bb31147 Mon Sep 17 00:00:00 2001 From: Kit La Touche Date: Thu, 14 Nov 2024 16:59:24 -0500 Subject: Add in start of tests --- .../lib/components/ChangePassword.svelte.test.js | 28 ++++++++++++++++++++++ .../components/CreateChannelForm.svelte.test.js | 1 + ui/tests/lib/components/Invite.svelte.test.js | 1 + ui/tests/lib/components/LogOut.svelte.test.js | 1 + ui/tests/lib/components/Message.svelte.test.js | 2 ++ .../lib/components/MessageInput.svelte.test.js | 2 ++ 6 files changed, 35 insertions(+) create mode 100644 ui/tests/lib/components/ChangePassword.svelte.test.js create mode 100644 ui/tests/lib/components/CreateChannelForm.svelte.test.js create mode 100644 ui/tests/lib/components/Invite.svelte.test.js create mode 100644 ui/tests/lib/components/LogOut.svelte.test.js create mode 100644 ui/tests/lib/components/Message.svelte.test.js create mode 100644 ui/tests/lib/components/MessageInput.svelte.test.js (limited to 'ui/tests') diff --git a/ui/tests/lib/components/ChangePassword.svelte.test.js b/ui/tests/lib/components/ChangePassword.svelte.test.js new file mode 100644 index 0000000..6e0e652 --- /dev/null +++ b/ui/tests/lib/components/ChangePassword.svelte.test.js @@ -0,0 +1,28 @@ +// async onsubmit(event) +// +// Example: +/* */ +import { flushSync, mount, unmount } from 'svelte'; +import { expect, test } from 'vitest'; +import ChangePassword from '$lib/components/ChangePassword.svelte'; + + +test('ChangePassword', () => { + // Instantiate the component using Svelte's `mount` API + const component = mount(ChangePassword, { + target: document.body, // `document` exists because of jsdom + props: { initial: 0 } + }); + + expect(document.body.innerHTML).toBe(''); + + // Click the button, then flush the changes so you can synchronously write expectations + document.body.querySelector('button').click(); + flushSync(); + + expect(document.body.innerHTML).toBe(''); + + // Remove the component from the DOM + unmount(component); +}); +/* */ diff --git a/ui/tests/lib/components/CreateChannelForm.svelte.test.js b/ui/tests/lib/components/CreateChannelForm.svelte.test.js new file mode 100644 index 0000000..0380e01 --- /dev/null +++ b/ui/tests/lib/components/CreateChannelForm.svelte.test.js @@ -0,0 +1 @@ +// async handleSubmit(event) diff --git a/ui/tests/lib/components/Invite.svelte.test.js b/ui/tests/lib/components/Invite.svelte.test.js new file mode 100644 index 0000000..e4383cc --- /dev/null +++ b/ui/tests/lib/components/Invite.svelte.test.js @@ -0,0 +1 @@ +// async onsubmit(event) diff --git a/ui/tests/lib/components/LogOut.svelte.test.js b/ui/tests/lib/components/LogOut.svelte.test.js new file mode 100644 index 0000000..e4383cc --- /dev/null +++ b/ui/tests/lib/components/LogOut.svelte.test.js @@ -0,0 +1 @@ +// async onsubmit(event) diff --git a/ui/tests/lib/components/Message.svelte.test.js b/ui/tests/lib/components/Message.svelte.test.js new file mode 100644 index 0000000..d29a371 --- /dev/null +++ b/ui/tests/lib/components/Message.svelte.test.js @@ -0,0 +1,2 @@ +// onDelete(event) +// onmouseleave() diff --git a/ui/tests/lib/components/MessageInput.svelte.test.js b/ui/tests/lib/components/MessageInput.svelte.test.js new file mode 100644 index 0000000..7c7f9aa --- /dev/null +++ b/ui/tests/lib/components/MessageInput.svelte.test.js @@ -0,0 +1,2 @@ +// async onSubmit(event) +// onKeyDown(event) -- cgit v1.2.3