Skip to content

chore: add the unified spec tests #2688

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions test/spec/unified-test-format/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
SCHEMA=../schema-1.1.json

.PHONY: all invalid valid-fail valid-pass versioned-api HAS_AJV

all: invalid valid-fail valid-pass versioned-api

invalid: HAS_AJV
@# Redirect stdout to hide expected validation errors
@ajv test -s $(SCHEMA) -d "invalid/*.yml" --invalid > /dev/null && echo "invalid/*.yml passed test"

valid-fail: HAS_AJV
@ajv test -s $(SCHEMA) -d "valid-fail/*.yml" --valid

valid-pass: HAS_AJV
@ajv test -s $(SCHEMA) -d "valid-pass/*.yml" --valid

versioned-api: HAS_AJV
@ajv test -s $(SCHEMA) -d "../../versioned-api/tests/*.yml" --valid

HAS_AJV:
@if ! command -v ajv > /dev/null; then \
echo 'Error: need "npm install -g ajv-cli"' 1>&2; \
exit 1; \
fi
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"description": "collectionData-additionalProperties",
"schemaVersion": "1.0",
"createEntities": [
{
"client": {
"id": "client0"
}
},
{
"database": {
"id": "database0",
"client": "client0",
"databaseName": "foo"
}
},
{
"collection": {
"id": "collection0",
"database": "database0",
"collectionName": "foo",
"foo": 0
}
}
],
"initialData": [
{
"collectionName": "foo",
"databaseName": "foo",
"documents": [],
"foo": 0
}
],
"tests": [
{
"description": "foo",
"operations": []
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
description: "collectionData-additionalProperties"

schemaVersion: "1.0"

createEntities:
- client:
id: &client0 "client0"
- database:
id: &database0 "database0"
client: *client0
databaseName: &database0Name "foo"
- collection:
id: &collection0 "collection0"
database: *database0
collectionName: &collection0Name "foo"
foo: 0

initialData:
- collectionName: *collection0Name
databaseName: *database0Name
documents: []
foo: 0

tests:
- description: "foo"
operations: []
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"description": "collectionData-collectionName-required",
"schemaVersion": "1.0",
"createEntities": [
{
"client": {
"id": "client0"
}
},
{
"database": {
"id": "database0",
"client": "client0",
"databaseName": "foo"
}
},
{
"collection": {
"id": "collection0",
"database": "database0",
"collectionName": "foo",
"foo": 0
}
}
],
"initialData": [
{
"databaseName": "foo",
"documents": []
}
],
"tests": [
{
"description": "foo",
"operations": []
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
description: "collectionData-collectionName-required"

schemaVersion: "1.0"

createEntities:
- client:
id: &client0 "client0"
- database:
id: &database0 "database0"
client: *client0
databaseName: &database0Name "foo"
- collection:
id: &collection0 "collection0"
database: *database0
collectionName: &collection0Name "foo"
foo: 0

initialData:
- databaseName: *database0Name
documents: []

tests:
- description: "foo"
operations: []
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"description": "collectionData-collectionName-type",
"schemaVersion": "1.0",
"createEntities": [
{
"client": {
"id": "client0"
}
},
{
"database": {
"id": "database0",
"client": "client0",
"databaseName": "foo"
}
},
{
"collection": {
"id": "collection0",
"database": "database0",
"collectionName": "foo",
"foo": 0
}
}
],
"initialData": [
{
"collectionName": 0,
"databaseName": "foo",
"documents": []
}
],
"tests": [
{
"description": "foo",
"operations": []
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
description: "collectionData-collectionName-type"

schemaVersion: "1.0"

createEntities:
- client:
id: &client0 "client0"
- database:
id: &database0 "database0"
client: *client0
databaseName: &database0Name "foo"
- collection:
id: &collection0 "collection0"
database: *database0
collectionName: &collection0Name "foo"
foo: 0

initialData:
- collectionName: 0
databaseName: *database0Name
documents: []

tests:
- description: "foo"
operations: []
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"description": "collectionData-databaseName-required",
"schemaVersion": "1.0",
"createEntities": [
{
"client": {
"id": "client0"
}
},
{
"database": {
"id": "database0",
"client": "client0",
"databaseName": "foo"
}
},
{
"collection": {
"id": "collection0",
"database": "database0",
"collectionName": "foo",
"foo": 0
}
}
],
"initialData": [
{
"collectionName": "foo",
"documents": []
}
],
"tests": [
{
"description": "foo",
"operations": []
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
description: "collectionData-databaseName-required"

schemaVersion: "1.0"

createEntities:
- client:
id: &client0 "client0"
- database:
id: &database0 "database0"
client: *client0
databaseName: &database0Name "foo"
- collection:
id: &collection0 "collection0"
database: *database0
collectionName: &collection0Name "foo"
foo: 0

initialData:
- collectionName: *collection0Name
documents: []

tests:
- description: "foo"
operations: []
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"description": "collectionData-databaseName-type",
"schemaVersion": "1.0",
"createEntities": [
{
"client": {
"id": "client0"
}
},
{
"database": {
"id": "database0",
"client": "client0",
"databaseName": "foo"
}
},
{
"collection": {
"id": "collection0",
"database": "database0",
"collectionName": "foo",
"foo": 0
}
}
],
"initialData": [
{
"collectionName": "foo",
"databaseName": 0,
"documents": []
}
],
"tests": [
{
"description": "foo",
"operations": []
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
description: "collectionData-databaseName-type"

schemaVersion: "1.0"

createEntities:
- client:
id: &client0 "client0"
- database:
id: &database0 "database0"
client: *client0
databaseName: &database0Name "foo"
- collection:
id: &collection0 "collection0"
database: *database0
collectionName: &collection0Name "foo"
foo: 0

initialData:
- collectionName: *collection0Name
databaseName: 0
documents: []

tests:
- description: "foo"
operations: []
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"description": "collectionData-documents-items",
"schemaVersion": "1.0",
"createEntities": [
{
"client": {
"id": "client0"
}
},
{
"database": {
"id": "database0",
"client": "client0",
"databaseName": "foo"
}
},
{
"collection": {
"id": "collection0",
"database": "database0",
"collectionName": "foo",
"foo": 0
}
}
],
"initialData": [
{
"collectionName": "foo",
"databaseName": "foo",
"documents": [
0
]
}
],
"tests": [
{
"description": "foo",
"operations": []
}
]
}
Loading