feat: #7079 created VnLocation front test #1126
|
@ -5,7 +5,6 @@ import { vi, afterEach, expect, it, beforeEach, describe } from 'vitest';
|
||||||
function buildComponent(data) {
|
function buildComponent(data) {
|
||||||
return createWrapper(VnLocation, {
|
return createWrapper(VnLocation, {
|
||||||
global: {
|
global: {
|
||||||
stubs: [''],
|
|
||||||
props: {
|
props: {
|
||||||
jsegarra marked this conversation as resolved
|
|||||||
location: data
|
location: data
|
||||||
}
|
}
|
||||||
|
@ -32,29 +31,25 @@ describe('formatLocation', () => {
|
||||||
it('should return the postcode, city, province and country', () => {
|
it('should return the postcode, city, province and country', () => {
|
||||||
const location = { ...locationBase };
|
const location = { ...locationBase };
|
||||||
const vm = buildComponent(location);
|
const vm = buildComponent(location);
|
||||||
const parts = vm.formatLocation(location);
|
expect(vm.formatLocation(location)).toEqual('46680, Algemesi(Valencia), Spain');
|
||||||
expect(parts).toEqual('46680, Algemesi(Valencia), Spain');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return the postcode and country', () => {
|
it('should return the postcode and country', () => {
|
||||||
const location = { ...locationBase, city: undefined };
|
const location = { ...locationBase, city: undefined };
|
||||||
const vm = buildComponent(location);
|
const vm = buildComponent(location);
|
||||||
const parts = vm.formatLocation(location);
|
expect(vm.formatLocation(location)).toEqual('46680, Spain');
|
||||||
expect(parts).toEqual('46680, Spain');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return the city, province and country', () => {
|
it('should return the city, province and country', () => {
|
||||||
const location = { ...locationBase, postcode: undefined };
|
const location = { ...locationBase, postcode: undefined };
|
||||||
const vm = buildComponent(location);
|
const vm = buildComponent(location);
|
||||||
const parts = vm.formatLocation(location);
|
expect(vm.formatLocation(location)).toEqual('Algemesi(Valencia), Spain');
|
||||||
expect(parts).toEqual('Algemesi(Valencia), Spain');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return the country', () => {
|
it('should return the country', () => {
|
||||||
const location = { ...locationBase, postcode: undefined, city: undefined, province: undefined };
|
const location = { ...locationBase, postcode: undefined, city: undefined, province: undefined };
|
||||||
const vm = buildComponent(location);
|
const vm = buildComponent(location);
|
||||||
const parts = vm.formatLocation(location);
|
expect(vm.formatLocation(location)).toEqual('Spain');
|
||||||
expect(parts).toEqual('Spain');
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -73,28 +68,24 @@ describe('showLabel', () => {
|
||||||
it('should show the label with postcode, city, province and country', () => {
|
it('should show the label with postcode, city, province and country', () => {
|
||||||
const location = { ...locationBase };
|
const location = { ...locationBase };
|
||||||
const vm = buildComponent(location);
|
const vm = buildComponent(location);
|
||||||
const label = vm.showLabel(location);
|
expect(vm.showLabel(location)).toEqual('46680, Algemesi(Valencia), Spain');
|
||||||
expect(label).toEqual('46680, Algemesi(Valencia), Spain');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should show the label with postcode and country', () => {
|
it('should show the label with postcode and country', () => {
|
||||||
const location = { ...locationBase, town: undefined };
|
const location = { ...locationBase, town: undefined };
|
||||||
const vm = buildComponent(location);
|
const vm = buildComponent(location);
|
||||||
const label = vm.showLabel(location);
|
expect(vm.showLabel(location)).toEqual('46680, Spain');
|
||||||
expect(label).toEqual('46680, Spain');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should show the label with city, province and country', () => {
|
it('should show the label with city, province and country', () => {
|
||||||
const location = { ...locationBase, code: undefined };
|
const location = { ...locationBase, code: undefined };
|
||||||
const vm = buildComponent(location);
|
const vm = buildComponent(location);
|
||||||
const label = vm.showLabel(location);
|
expect(vm.showLabel(location)).toEqual('Algemesi(Valencia), Spain');
|
||||||
expect(label).toEqual('Algemesi(Valencia), Spain');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should show the label with country', () => {
|
it('should show the label with country', () => {
|
||||||
const location = { ...locationBase, code: undefined, town: undefined, province: undefined };
|
const location = { ...locationBase, code: undefined, town: undefined, province: undefined };
|
||||||
const vm = buildComponent(location);
|
const vm = buildComponent(location);
|
||||||
const label = vm.showLabel(location);
|
expect(vm.showLabel(location)).toEqual('Spain');
|
||||||
expect(label).toEqual('Spain');
|
|
||||||
});
|
});
|
||||||
});
|
});
|
Loading…
Reference in New Issue
Que hace esta linea?
Si la eliminas que ocurre?