import { describe, it, expect } from 'vitest';
import { mount } from '@vue/test-utils';
import { createVuetify } from 'vuetify';

import ChangePasswordCard from '../../resources/js/components/settings/security/ChangePasswordCard.vue';

const vuetify = createVuetify();

describe('ChangePasswordCard (Q.DEFER.003 sub-B)', () => {
    const factory = () => mount(ChangePasswordCard, { global: { plugins: [vuetify] } });

    it('renders heading «Пароль»', () => {
        const wrapper = factory();
        expect(wrapper.find('h3').text()).toBe('Пароль');
    });

    it('shows last-change hint text', () => {
        const wrapper = factory();
        expect(wrapper.text()).toContain('Последняя смена: 12.04.2026');
        expect(wrapper.text()).toContain('26 дней назад');
    });

    it('renders «Сменить пароль» button with lock-reset icon', () => {
        const wrapper = factory();
        const btn = wrapper.find('button');
        expect(btn.exists()).toBe(true);
        expect(btn.text()).toContain('Сменить пароль');
        expect(wrapper.find('.mdi-lock-reset').exists()).toBe(true);
    });
});
