-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
51 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 0 additions & 45 deletions
45
resources/assets/js/__tests__/components/artist/info.spec.ts
This file was deleted.
Oops, something went wrong.
9 changes: 0 additions & 9 deletions
9
resources/assets/js/__tests__/components/auth/__snapshots__/login-form.spec.ts.snap
This file was deleted.
Oops, something went wrong.
26 changes: 0 additions & 26 deletions
26
resources/assets/js/__tests__/components/auth/login-form.spec.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { mockHelper, render } from '@/__tests__/__helpers__' | ||
import { cleanup, fireEvent } from '@testing-library/vue' | ||
import { beforeEach, expect, it } from 'vitest' | ||
import { userStore } from '@/stores' | ||
import LoginFrom from './LoginForm.vue' | ||
import Btn from '@/components/ui/Btn.vue' | ||
|
||
beforeEach(() => { | ||
mockHelper.restoreAllMocks() | ||
cleanup() | ||
}) | ||
|
||
it('renders', () => expect(render(LoginFrom, { | ||
global: { | ||
stubs: { | ||
Btn | ||
} | ||
} | ||
}).html()).toMatchSnapshot()) | ||
|
||
it('triggers login when submitted', async () => { | ||
const mock = mockHelper.mock(userStore, 'login') | ||
|
||
const { getByTestId, getByPlaceholderText } = render(LoginFrom, { | ||
global: { | ||
stubs: { | ||
Btn | ||
} | ||
} | ||
}) | ||
|
||
await fireEvent.update(getByPlaceholderText('Email Address'), '[email protected]') | ||
await fireEvent.update(getByPlaceholderText('Password'), 'secret') | ||
await fireEvent.submit(getByTestId('login-form')) | ||
|
||
expect(mock).toHaveBeenCalledWith('[email protected]', 'secret') | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
resources/assets/js/components/auth/__snapshots__/LoginForm.spec.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// Vitest Snapshot v1 | ||
|
||
exports[`renders 1`] = ` | ||
"<form class=\\"\\" data-testid=\\"login-form\\" data-v-7d840a46=\\"\\"> | ||
<div class=\\"logo\\" data-v-7d840a46=\\"\\"><img alt=\\"Koel's logo\\" src=\\"/resources/assets/img/logo.svg\\" width=\\"156\\" data-v-7d840a46=\\"\\" /></div><input autofocus=\\"\\" placeholder=\\"Email Address\\" required=\\"\\" type=\\"email\\" data-v-7d840a46=\\"\\" /><input placeholder=\\"Password\\" required=\\"\\" type=\\"password\\" data-v-7d840a46=\\"\\" /><button type=\\"submit\\" data-v-27deb898=\\"\\" data-v-7d840a46=\\"\\">Log In</button> | ||
</form>" | ||
`; |