Files
interview-demo-code/frontend/spa/tests/unit/components/Price.test.js
Nikita Kiselev 3abcb18f0c
Some checks failed
Telegram Mini App Shop Builder / Compute version metadata (push) Has been cancelled
Telegram Mini App Shop Builder / Run Frontend tests (push) Has been cancelled
Telegram Mini App Shop Builder / Run Backend tests (push) Has been cancelled
Telegram Mini App Shop Builder / Run PHP_CodeSniffer (push) Has been cancelled
Telegram Mini App Shop Builder / Build module. (push) Has been cancelled
Telegram Mini App Shop Builder / release (push) Has been cancelled
Squashed commit message
2026-03-11 22:55:28 +03:00

46 lines
1.1 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { describe, it, expect } from 'vitest';
import { mount } from '@vue/test-utils';
import Price from '@/components/Price.vue';
describe('Price.vue', () => {
it('должен отображать цену с символом рубля', () => {
const wrapper = mount(Price, {
props: {
value: 1000,
},
});
expect(wrapper.text()).toContain('₽');
expect(wrapper.text()).toContain('1 000');
});
it('должен использовать значение по умолчанию 0', () => {
const wrapper = mount(Price, {
props: {},
});
expect(wrapper.text()).toContain('₽');
});
it('должен форматировать большие числа', () => {
const wrapper = mount(Price, {
props: {
value: 1234567,
},
});
expect(wrapper.text()).toContain('1 234 567');
});
it('должен обрабатывать нулевое значение', () => {
const wrapper = mount(Price, {
props: {
value: 0,
},
});
expect(wrapper.text()).toContain('₽');
});
});