diff options
Diffstat (limited to 'spec/frontend/clusters_list/components/agent_table_spec.js')
-rw-r--r-- | spec/frontend/clusters_list/components/agent_table_spec.js | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/spec/frontend/clusters_list/components/agent_table_spec.js b/spec/frontend/clusters_list/components/agent_table_spec.js index a6d76b069cf..887c17bb4ad 100644 --- a/spec/frontend/clusters_list/components/agent_table_spec.js +++ b/spec/frontend/clusters_list/components/agent_table_spec.js @@ -1,16 +1,22 @@ import { GlLink, GlIcon } from '@gitlab/ui'; import AgentTable from '~/clusters_list/components/agent_table.vue'; +import AgentOptions from '~/clusters_list/components/agent_options.vue'; import { ACTIVE_CONNECTION_TIME } from '~/clusters_list/constants'; import { mountExtended } from 'helpers/vue_test_utils_helper'; +import { stubComponent } from 'helpers/stub_component'; import timeagoMixin from '~/vue_shared/mixins/timeago'; const connectedTimeNow = new Date(); const connectedTimeInactive = new Date(connectedTimeNow.getTime() - ACTIVE_CONNECTION_TIME); +const provideData = { + projectPath: 'path/to/project', +}; const propsData = { agents: [ { name: 'agent-1', + id: 'agent-1-id', configFolder: { webPath: '/agent/full/path', }, @@ -21,6 +27,7 @@ const propsData = { }, { name: 'agent-2', + id: 'agent-2-id', webPath: '/agent-2', status: 'active', lastContact: connectedTimeNow.getTime(), @@ -34,6 +41,7 @@ const propsData = { }, { name: 'agent-3', + id: 'agent-3-id', webPath: '/agent-3', status: 'inactive', lastContact: connectedTimeInactive.getTime(), @@ -48,6 +56,10 @@ const propsData = { ], }; +const AgentOptionsStub = stubComponent(AgentOptions, { + template: `<div></div>`, +}); + describe('AgentTable', () => { let wrapper; @@ -57,15 +69,21 @@ describe('AgentTable', () => { const findLastContactText = (at) => wrapper.findAllByTestId('cluster-agent-last-contact').at(at); const findConfiguration = (at) => wrapper.findAllByTestId('cluster-agent-configuration-link').at(at); + const findAgentOptions = () => wrapper.findAllComponents(AgentOptions); beforeEach(() => { - wrapper = mountExtended(AgentTable, { propsData }); + wrapper = mountExtended(AgentTable, { + propsData, + provide: provideData, + stubs: { + AgentOptions: AgentOptionsStub, + }, + }); }); afterEach(() => { if (wrapper) { wrapper.destroy(); - wrapper = null; } }); @@ -108,5 +126,9 @@ describe('AgentTable', () => { expect(findLink.exists()).toBe(hasLink); expect(findConfiguration(lineNumber).text()).toBe(agentPath); }); + + it('displays actions menu for each agent', () => { + expect(findAgentOptions()).toHaveLength(3); + }); }); }); |