ElectronVersions.spec.ts 560 B

123456789101112131415161718192021
  1. import {mount} from '@vue/test-utils';
  2. import {expect, test, vi} from 'vitest';
  3. import ElectronVersions from '../src/components/ElectronVersions.vue';
  4. vi.mock('#preload', () => {
  5. return {
  6. versions: {lib1: 1, lib2: 2},
  7. };
  8. });
  9. test('ElectronVersions component', async () => {
  10. expect(ElectronVersions).toBeTruthy();
  11. const wrapper = mount(ElectronVersions);
  12. const lis = wrapper.findAll<HTMLElement>('li');
  13. expect(lis.length).toBe(2);
  14. expect(lis[0].text()).toBe('lib1: v1');
  15. expect(lis[1].text()).toBe('lib2: v2');
  16. });