Skip to content

Commit

Permalink
test(address): update
Browse files Browse the repository at this point in the history
  • Loading branch information
eiinu committed Mar 11, 2024
1 parent 6d69f4d commit e81feab
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 69 deletions.

This file was deleted.

10 changes: 3 additions & 7 deletions src/packages/__VUE/address/__tests__/address.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ import { mount } from '@vue/test-utils';
import { nextTick } from 'vue';
import Address from '../index.vue';
import { addressListData, addressExistData } from '../address-list';
import { mockElementMethod, sleep } from '@/packages/utils/unit';

mockElementMethod(Element, 'scrollTo');

test('Address: address render', async () => {
const wrapper = mount(Address, {
Expand Down Expand Up @@ -36,12 +33,11 @@ test('Address: choose address item', async () => {
}
}
});
const fn = mockElementMethod(Element, 'scrollTo');
expect(wrapper.html()).toMatchSnapshot();
expect(wrapper.find('.nut-address__region-item').text()).toEqual('请选择');
expect(wrapper.findAll('.nut-address__region-item').length).toEqual(1);
wrapper.find('.nut-address__detail-item').trigger('click');
await sleep(0);
expect(fn).toBeCalled();
await nextTick();
expect(wrapper.findAll('.nut-address__detail-item.active').length).toEqual(1);
});

test('Address: default choose address', async () => {
Expand Down

0 comments on commit e81feab

Please sign in to comment.