From dc40ea130fc4fdbc0ac87bdf516293de8b995c84 Mon Sep 17 00:00:00 2001 From: Wei Zhou Date: Thu, 29 Dec 2022 09:08:54 +0100 Subject: [PATCH] UI: fix ui test errors (#7030) --- .github/workflows/ui.yml | 2 +- ui/tests/mockData/AutogenView.mock.json | 6 +++--- ui/tests/unit/components/view/ActionButton.spec.js | 3 +++ ui/tests/unit/views/AutogenView.spec.js | 14 +++++++------- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ui.yml b/.github/workflows/ui.yml index 6f1062bb11b..8b60f470682 100644 --- a/.github/workflows/ui.yml +++ b/.github/workflows/ui.yml @@ -25,7 +25,7 @@ concurrency: jobs: build: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v3 diff --git a/ui/tests/mockData/AutogenView.mock.json b/ui/tests/mockData/AutogenView.mock.json index dee7965c3b7..8d932e0e7aa 100644 --- a/ui/tests/mockData/AutogenView.mock.json +++ b/ui/tests/mockData/AutogenView.mock.json @@ -135,11 +135,11 @@ "testApiNameCase5": { "params": [ { - "name": "column2", + "name": "column1", "type": "string" }, { - "name": "column1", + "name": "column2", "type": "string" }, { @@ -642,4 +642,4 @@ "component": {} } ] -} \ No newline at end of file +} diff --git a/ui/tests/unit/components/view/ActionButton.spec.js b/ui/tests/unit/components/view/ActionButton.spec.js index 139be7ab1b1..4677a47cd14 100644 --- a/ui/tests/unit/components/view/ActionButton.spec.js +++ b/ui/tests/unit/components/view/ActionButton.spec.js @@ -272,6 +272,7 @@ describe('Components > View > ActionButton.vue', () => { } } }) + wrapper.vm.hasOwnProperty = () => Object.hasOwnProperty; const handleShowBadge = jest.spyOn(wrapper.vm, 'handleShowBadge') await wrapper.setProps({ resource: null }) @@ -286,6 +287,7 @@ describe('Components > View > ActionButton.vue', () => { } } }) + wrapper.vm.hasOwnProperty = () => Object.hasOwnProperty; const handleShowBadge = jest.spyOn(wrapper.vm, 'handleShowBadge') await wrapper.setProps({ resource: { id: null } }) @@ -300,6 +302,7 @@ describe('Components > View > ActionButton.vue', () => { } } }) + wrapper.vm.hasOwnProperty = () => Object.hasOwnProperty; const handleShowBadge = jest.spyOn(wrapper.vm, 'handleShowBadge') await wrapper.setProps({ resource: { diff --git a/ui/tests/unit/views/AutogenView.spec.js b/ui/tests/unit/views/AutogenView.spec.js index 6ca6410e0b7..18872107d77 100644 --- a/ui/tests/unit/views/AutogenView.spec.js +++ b/ui/tests/unit/views/AutogenView.spec.js @@ -1029,11 +1029,11 @@ describe('Views > AutogenView.vue', () => { await flushPromises() expect(wrapper.vm.currentAction.params).toEqual([ + { name: 'id', type: 'string' }, + { name: 'name', type: 'string' }, { name: 'column1', type: 'string' }, { name: 'column2', type: 'string' }, - { name: 'column3', type: 'string' }, - { name: 'name', type: 'string' }, - { name: 'id', type: 'string' } + { name: 'column3', type: 'string' } ]) expect(wrapper.vm.currentAction.paramFields).toEqual([]) expect(wrapper.vm.showAction).toBeTruthy() @@ -1094,11 +1094,11 @@ describe('Views > AutogenView.vue', () => { await flushPromises() expect(wrapper.vm.currentAction.params).toEqual([ + { name: 'id', type: 'string' }, + { name: 'name', type: 'string' }, { name: 'column1', type: 'string' }, { name: 'column2', type: 'string' }, - { name: 'column3', type: 'string' }, - { name: 'name', type: 'string' }, - { name: 'id', type: 'string' } + { name: 'column3', type: 'string' } ]) expect(wrapper.vm.currentAction.paramFields).toEqual([ { name: 'id', type: 'string' }, @@ -1821,7 +1821,7 @@ describe('Views > AutogenView.vue', () => { expect(router.currentRoute.value.path).toEqual('/guestnetwork') expect(router.currentRoute.value.query).toEqual({ filter: 'filter', - type: 'filter', + networkfilter: 'filter', page: '1', pagesize: '20' })