-
Notifications
You must be signed in to change notification settings - Fork 2
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
2 changed files
with
61 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { describe, it, expect, vi } from 'vitest'; | ||
import { shallowMount } from '@vue/test-utils'; | ||
import '@/shared/lib/vitest-utils/cookiesI18n-mock'; | ||
import AboutSection from '../AboutSection.vue'; | ||
import i18n from '@/shared/lib/i18n'; | ||
import { UiButton } from '@/shared/ui'; | ||
|
||
const mockRouter = { | ||
push: vi.fn(), | ||
beforeEach: vi.fn() | ||
}; | ||
|
||
describe('tests for AboutSection.vue', () => { | ||
const wrapper = shallowMount(AboutSection, { | ||
global: { | ||
plugins: [i18n], | ||
mocks: { | ||
$router: mockRouter | ||
} | ||
} | ||
}); | ||
|
||
it('should be render correctly', () => { | ||
expect(wrapper.html()).toMatchSnapshot(); | ||
}); | ||
|
||
it('should redirect correctly ', async () => { | ||
const btn = wrapper.find('.btns').findAllComponents(UiButton).at(0); | ||
await btn.trigger('click'); | ||
expect(mockRouter.push).toHaveBeenCalledWith({ name: 'registration' }); | ||
}); | ||
}); |
29 changes: 29 additions & 0 deletions
29
src/widgets/welcome/ui/__tests__/__snapshots__/AboutSection.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,29 @@ | ||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html | ||
|
||
exports[`tests for AboutSection.vue > should be render correctly 1`] = ` | ||
"<section class="container"> | ||
<div class="badge"><span style="margin-right: 3px;">✨</span><span class="text-sm">Core: Task Boards, Real-Time Tracking</span> | ||
<anonymous-stub size="14"></anonymous-stub> | ||
</div> | ||
<h1>Your path to perfection</h1> | ||
<p class="text-lg">Jenda is a cloud-based program for efficient collaborative and individual project and task management.</p> | ||
<div class="btns"> | ||
<ui-button-stub variant="default" size="md"></ui-button-stub> | ||
<ui-button-stub variant="outline" size="md" class="btn_git"></ui-button-stub> | ||
</div> | ||
</section>" | ||
`; | ||
|
||
exports[`tests for AboutSection.vue > should navigate correctly 1`] = ` | ||
"<section class="container"> | ||
<div class="badge"><span style="margin-right: 3px;">✨</span><span class="text-sm">Core: Task Boards, Real-Time Tracking</span> | ||
<anonymous-stub size="14"></anonymous-stub> | ||
</div> | ||
<h1>Your path to perfection</h1> | ||
<p class="text-lg">Jenda is a cloud-based program for efficient collaborative and individual project and task management.</p> | ||
<div class="btns"> | ||
<ui-button-stub variant="default" size="md"></ui-button-stub> | ||
<ui-button-stub variant="outline" size="md" class="btn_git"></ui-button-stub> | ||
</div> | ||
</section>" | ||
`; |