Skip to content
Snippets Groups Projects
Commit 95c1c031 authored by Klaus Fischer's avatar Klaus Fischer
Browse files

Added tests for higher versions

parent bb4f958c
No related branches found
No related tags found
1 merge request!5Replace $schema enum by $schema pattern
......@@ -12,3 +12,6 @@ node_modules/
npm-debug.log*
yarn-debug.log*
yarn-error.log*
examples/
examples_fail/
......@@ -15,6 +15,7 @@ stages:
- lint
- build
- upload
- test
lint:
stage: lint
......@@ -61,3 +62,17 @@ upload:release:
script:
- sed -i "s,SCHEMA_VERSION,$CI_COMMIT_TAG,g" dist/set-payload.schema.json
- rsync -Lvz -e "ssh -o CheckHostIP=no" ./dist/set-payload.schema.json fitko@dorado.uberspace.de:schema.fitko.de/fit-connect/set-payload/$CI_COMMIT_TAG/
test:
stage: test
image: node:16.16
script:
- yarn bundle
- yarn test
test-failing:
stage: test
image: node:16.16
script:
- yarn bundle
- yarn test_higher_versions
......@@ -2,7 +2,10 @@
# Create a directory for the examples
rm -rf examples
rm -rf examples_failes
mkdir -p examples
mkdir examples_failes
# Run over Templates and create examples
for template in templates/*.json; do
......@@ -18,4 +21,9 @@ for template in templates/*.json; do
cat $template | sed -e "s|SCHEMA_VERSION|$version|g" > ./examples/"$template_name"_"$version".json
done
set -- "2.0.0" "3.0.1" "2.0.2" "2.0.11" "2.1.0" "3.5.11"
for version in "$@"; do
cat $template | sed -e "s|SCHEMA_VERSION|$version|g" > ./examples_fail/"$template_name"_"$version".json
done
done
......@@ -2,7 +2,8 @@
"scripts": {
"bundle": "sh bundle.sh",
"lint": "ajv compile --spec=draft2020 -c ajv-formats -s dist/set-payload.schema.json",
"test": "ajv validate --errors=text --verbose --all-errors -d examples/**/*.json --spec=draft2020 -c ajv-formats -s dist/set-payload.schema.json"
"test": "ajv validate --errors=text --verbose --all-errors -d examples/**/*.json --spec=draft2020 -c ajv-formats -s dist/set-payload.schema.json",
"test_higher_version": "! ajv validate --errors=text --verbose --all-errors -d examples_fail/**/*.json --spec=draft2020 -c ajv-formats -s dist/metadata.schema.json"
},
"dependencies": {
"@apidevtools/json-schema-ref-parser": "9.0.9",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment