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/editor/schema/ci/ci_schema_spec.js')
-rw-r--r--spec/frontend/editor/schema/ci/ci_schema_spec.js71
1 files changed, 26 insertions, 45 deletions
diff --git a/spec/frontend/editor/schema/ci/ci_schema_spec.js b/spec/frontend/editor/schema/ci/ci_schema_spec.js
index fc86907c144..32126a5fd9a 100644
--- a/spec/frontend/editor/schema/ci/ci_schema_spec.js
+++ b/spec/frontend/editor/schema/ci/ci_schema_spec.js
@@ -18,9 +18,7 @@ import VariablesJson from './json_tests/positive_tests/variables.json';
import DefaultNoAdditionalPropertiesJson from './json_tests/negative_tests/default_no_additional_properties.json';
import InheritDefaultNoAdditionalPropertiesJson from './json_tests/negative_tests/inherit_default_no_additional_properties.json';
import JobVariablesMustNotContainObjectsJson from './json_tests/negative_tests/job_variables_must_not_contain_objects.json';
-import ReleaseAssetsLinksEmptyJson from './json_tests/negative_tests/release_assets_links_empty.json';
-import ReleaseAssetsLinksInvalidLinkTypeJson from './json_tests/negative_tests/release_assets_links_invalid_link_type.json';
-import ReleaseAssetsLinksMissingJson from './json_tests/negative_tests/release_assets_links_missing.json';
+import ReleaseAssetsLinksJson from './json_tests/negative_tests/release_assets_links.json';
import RetryUnknownWhenJson from './json_tests/negative_tests/retry_unknown_when.json';
// YAML POSITIVE TEST
@@ -31,34 +29,22 @@ import IncludeYaml from './yaml_tests/positive_tests/include.yml';
import RulesYaml from './yaml_tests/positive_tests/rules.yml';
import ProjectPathYaml from './yaml_tests/positive_tests/project_path.yml';
import VariablesYaml from './yaml_tests/positive_tests/variables.yml';
+import JobWhenYaml from './yaml_tests/positive_tests/job_when.yml';
// YAML NEGATIVE TEST
import ArtifactsNegativeYaml from './yaml_tests/negative_tests/artifacts.yml';
-import CacheNegativeYaml from './yaml_tests/negative_tests/cache.yml';
+import CacheKeyNeative from './yaml_tests/negative_tests/cache.yml';
import IncludeNegativeYaml from './yaml_tests/negative_tests/include.yml';
-import RulesNegativeYaml from './yaml_tests/negative_tests/rules.yml';
-import VariablesNegativeYaml from './yaml_tests/negative_tests/variables.yml';
-
+import JobWhenNegativeYaml from './yaml_tests/negative_tests/job_when.yml';
import ProjectPathIncludeEmptyYaml from './yaml_tests/negative_tests/project_path/include/empty.yml';
import ProjectPathIncludeInvalidVariableYaml from './yaml_tests/negative_tests/project_path/include/invalid_variable.yml';
import ProjectPathIncludeLeadSlashYaml from './yaml_tests/negative_tests/project_path/include/leading_slash.yml';
import ProjectPathIncludeNoSlashYaml from './yaml_tests/negative_tests/project_path/include/no_slash.yml';
import ProjectPathIncludeTailSlashYaml from './yaml_tests/negative_tests/project_path/include/tailing_slash.yml';
-import ProjectPathTriggerIncludeEmptyYaml from './yaml_tests/negative_tests/project_path/trigger/include/empty.yml';
-import ProjectPathTriggerIncludeInvalidVariableYaml from './yaml_tests/negative_tests/project_path/trigger/include/invalid_variable.yml';
-import ProjectPathTriggerIncludeLeadSlashYaml from './yaml_tests/negative_tests/project_path/trigger/include/leading_slash.yml';
-import ProjectPathTriggerIncludeNoSlashYaml from './yaml_tests/negative_tests/project_path/trigger/include/no_slash.yml';
-import ProjectPathTriggerIncludeTailSlashYaml from './yaml_tests/negative_tests/project_path/trigger/include/tailing_slash.yml';
-import ProjectPathTriggerMinimalEmptyYaml from './yaml_tests/negative_tests/project_path/trigger/minimal/empty.yml';
-import ProjectPathTriggerMinimalInvalidVariableYaml from './yaml_tests/negative_tests/project_path/trigger/minimal/invalid_variable.yml';
-import ProjectPathTriggerMinimalLeadSlashYaml from './yaml_tests/negative_tests/project_path/trigger/minimal/leading_slash.yml';
-import ProjectPathTriggerMinimalNoSlashYaml from './yaml_tests/negative_tests/project_path/trigger/minimal/no_slash.yml';
-import ProjectPathTriggerMinimalTailSlashYaml from './yaml_tests/negative_tests/project_path/trigger/minimal/tailing_slash.yml';
-import ProjectPathTriggerProjectEmptyYaml from './yaml_tests/negative_tests/project_path/trigger/project/empty.yml';
-import ProjectPathTriggerProjectInvalidVariableYaml from './yaml_tests/negative_tests/project_path/trigger/project/invalid_variable.yml';
-import ProjectPathTriggerProjectLeadSlashYaml from './yaml_tests/negative_tests/project_path/trigger/project/leading_slash.yml';
-import ProjectPathTriggerProjectNoSlashYaml from './yaml_tests/negative_tests/project_path/trigger/project/no_slash.yml';
-import ProjectPathTriggerProjectTailSlashYaml from './yaml_tests/negative_tests/project_path/trigger/project/tailing_slash.yml';
+import RulesNegativeYaml from './yaml_tests/negative_tests/rules.yml';
+import TriggerNegative from './yaml_tests/negative_tests/trigger.yml';
+import VariablesInvalidSyntaxDescYaml from './yaml_tests/negative_tests/variables/invalid_syntax_desc.yml';
+import VariablesWrongSyntaxUsageExpand from './yaml_tests/negative_tests/variables/wrong_syntax_usage_expand.yml';
const ajv = new Ajv({
strictTypes: false,
@@ -68,7 +54,7 @@ const ajv = new Ajv({
ajv.addKeyword('markdownDescription');
AjvFormats(ajv);
-const schema = ajv.compile(CiSchema);
+const ajvSchema = ajv.compile(CiSchema);
describe('positive tests', () => {
it.each(
@@ -90,12 +76,17 @@ describe('positive tests', () => {
CacheYaml,
FilterYaml,
IncludeYaml,
+ JobWhenYaml,
RulesYaml,
VariablesYaml,
ProjectPathYaml,
}),
)('schema validates %s', (_, input) => {
- expect(input).toValidateJsonSchema(schema);
+ // We construct a new "JSON" from each main key that is inside a
+ // file which allow us to make sure each blob is valid.
+ Object.keys(input).forEach((key) => {
+ expect({ [key]: input[key] }).toValidateJsonSchema(ajvSchema);
+ });
});
});
@@ -106,39 +97,29 @@ describe('negative tests', () => {
DefaultNoAdditionalPropertiesJson,
JobVariablesMustNotContainObjectsJson,
InheritDefaultNoAdditionalPropertiesJson,
- ReleaseAssetsLinksEmptyJson,
- ReleaseAssetsLinksInvalidLinkTypeJson,
- ReleaseAssetsLinksMissingJson,
+ ReleaseAssetsLinksJson,
RetryUnknownWhenJson,
// YAML
ArtifactsNegativeYaml,
- CacheNegativeYaml,
+ CacheKeyNeative,
IncludeNegativeYaml,
+ JobWhenNegativeYaml,
RulesNegativeYaml,
- VariablesNegativeYaml,
+ VariablesInvalidSyntaxDescYaml,
+ VariablesWrongSyntaxUsageExpand,
ProjectPathIncludeEmptyYaml,
ProjectPathIncludeInvalidVariableYaml,
ProjectPathIncludeLeadSlashYaml,
ProjectPathIncludeNoSlashYaml,
ProjectPathIncludeTailSlashYaml,
- ProjectPathTriggerIncludeEmptyYaml,
- ProjectPathTriggerIncludeInvalidVariableYaml,
- ProjectPathTriggerIncludeLeadSlashYaml,
- ProjectPathTriggerIncludeNoSlashYaml,
- ProjectPathTriggerIncludeTailSlashYaml,
- ProjectPathTriggerMinimalEmptyYaml,
- ProjectPathTriggerMinimalInvalidVariableYaml,
- ProjectPathTriggerMinimalLeadSlashYaml,
- ProjectPathTriggerMinimalNoSlashYaml,
- ProjectPathTriggerMinimalTailSlashYaml,
- ProjectPathTriggerProjectEmptyYaml,
- ProjectPathTriggerProjectInvalidVariableYaml,
- ProjectPathTriggerProjectLeadSlashYaml,
- ProjectPathTriggerProjectNoSlashYaml,
- ProjectPathTriggerProjectTailSlashYaml,
+ TriggerNegative,
}),
)('schema validates %s', (_, input) => {
- expect(input).not.toValidateJsonSchema(schema);
+ // We construct a new "JSON" from each main key that is inside a
+ // file which allow us to make sure each blob is invalid.
+ Object.keys(input).forEach((key) => {
+ expect({ [key]: input[key] }).not.toValidateJsonSchema(ajvSchema);
+ });
});
});