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/pipeline_wizard/validators_spec.js')
-rw-r--r--spec/frontend/pipeline_wizard/validators_spec.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/frontend/pipeline_wizard/validators_spec.js b/spec/frontend/pipeline_wizard/validators_spec.js
new file mode 100644
index 00000000000..1276c642f30
--- /dev/null
+++ b/spec/frontend/pipeline_wizard/validators_spec.js
@@ -0,0 +1,22 @@
+import { Document, parseDocument } from 'yaml';
+import { isValidStepSeq } from '~/pipeline_wizard/validators';
+import { steps as stepsYaml } from './mock/yaml';
+
+describe('prop validation', () => {
+ const steps = parseDocument(stepsYaml).toJS();
+ const getAsYamlNode = (value) => new Document(value).contents;
+
+ it('allows passing yaml nodes to the steps prop', () => {
+ const validSteps = getAsYamlNode(steps);
+ expect(isValidStepSeq(validSteps)).toBe(true);
+ });
+
+ it.each`
+ scenario | stepsValue
+ ${'not a seq'} | ${{ foo: 'bar' }}
+ ${'a step missing an input'} | ${[{ template: 'baz: boo' }]}
+ ${'an empty seq'} | ${[]}
+ `('throws an error when passing $scenario to the steps prop', ({ stepsValue }) => {
+ expect(isValidStepSeq(stepsValue)).toBe(false);
+ });
+});