#49 fix: labels en nodos de gráficos y municipio con departamento en proveedores

This commit is contained in:
2026-08-15 18:33:30 -05:00
parent 79100ef40e
commit 58b42d956b
6 changed files with 52 additions and 7 deletions

View File

@@ -60,6 +60,14 @@ describe('ProductSupplierOrganizationChart', () => {
expect(nodeIds).toContain('organization:3')
})
it('muestra el nombre de los nodos a través del label', () => {
const wrapper = mountChart()
const styles = wrapper.findComponent(CytoscapeChart).props('styles')
const nodeStyle = styles.find(style => style.selector === 'node').style
expect(nodeStyle.content).toBe('data(label)')
})
it('no muestra mensaje de próximamente cuando existen relaciones', () => {
const wrapper = mountChart()

View File

@@ -58,6 +58,14 @@ describe('ProductTerritoryChart', () => {
expect(nodeIds).toContain('country:1')
})
it('muestra el nombre de los nodos a través del label', () => {
const wrapper = mountChart()
const styles = wrapper.findComponent(CytoscapeChart).props('styles')
const nodeStyle = styles.find(style => style.selector === 'node').style
expect(nodeStyle.content).toBe('data(label)')
})
it('muestra mensaje de próximamente cuando ningún proveedor tiene territorio', () => {
const wrapper = mountChart({
provenance: [

View File

@@ -10,8 +10,13 @@ const organizations = [
]
const municipalities = [
{ id: 7, name: 'La Mesa' },
{ id: 8, name: 'San Antonio' },
{ id: 7, name: 'La Mesa', department: 2 },
{ id: 8, name: 'San Antonio', department: 3 },
]
const departments = [
{ id: 2, name: 'Cundinamarca' },
{ id: 3, name: 'Antioquia' },
]
const suppliers = [
@@ -44,6 +49,7 @@ function mockApi () {
getSuppliers: vi.fn().mockResolvedValue(suppliers),
getOrganizations: vi.fn().mockResolvedValue(organizations),
getMunicipalities: vi.fn().mockResolvedValue(municipalities),
getDepartments: vi.fn().mockResolvedValue(departments),
createSupplier: vi.fn().mockResolvedValue({}),
updateSupplier: vi.fn().mockResolvedValue({}),
deleteSupplier: vi.fn().mockResolvedValue({}),
@@ -68,6 +74,18 @@ describe('SuppliersManagement', () => {
expect(wrapper.text()).toContain('La Mesa')
})
it('muestra el departamento en el título del municipio', async () => {
const api = mockApi()
const wrapper = mountComponent(api)
await flushPromises()
await wrapper.find('[data-testid="supplier-create"]').trigger('click')
const autocomplete = wrapper.findAllComponents({ name: 'VAutocomplete' })[0]
const itemTitle = autocomplete.props('itemTitle')
expect(itemTitle({ id: 7, name: 'La Mesa', department: 2 })).toBe('La Mesa (Cundinamarca)')
})
it('crea un proveedor con organización y municipio', async () => {
const api = mockApi()
const wrapper = mountComponent(api)