Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/runner/components/stat/runner_online_stat_spec.js')
-rw-r--r--spec/frontend/runner/components/stat/runner_online_stat_spec.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/spec/frontend/runner/components/stat/runner_online_stat_spec.js b/spec/frontend/runner/components/stat/runner_online_stat_spec.js
new file mode 100644
index 00000000000..18f865aa22c
--- /dev/null
+++ b/spec/frontend/runner/components/stat/runner_online_stat_spec.js
@@ -0,0 +1,34 @@
+import { GlSingleStat } from '@gitlab/ui/dist/charts';
+import { shallowMount, mount } from '@vue/test-utils';
+import RunnerOnlineBadge from '~/runner/components/stat/runner_online_stat.vue';
+
+describe('RunnerOnlineBadge', () => {
+ let wrapper;
+
+ const findSingleStat = () => wrapper.findComponent(GlSingleStat);
+
+ const createComponent = ({ props = {} } = {}, mountFn = shallowMount) => {
+ wrapper = mountFn(RunnerOnlineBadge, {
+ propsData: {
+ value: '99',
+ ...props,
+ },
+ });
+ };
+
+ afterEach(() => {
+ wrapper.destroy();
+ });
+
+ it('Uses a success appearance', () => {
+ createComponent({}, shallowMount);
+
+ expect(findSingleStat().props('variant')).toBe('success');
+ });
+
+ it('Renders a value', () => {
+ createComponent({}, mount);
+
+ expect(wrapper.text()).toMatch(new RegExp(`Online Runners 99\\s+online`));
+ });
+});