Skip to content

Commit

Permalink
[INTERNAL] Schema: Add metadata.name tests for legacy specVersion
Browse files Browse the repository at this point in the history
Specification Versions <3.0 should allow any names
  • Loading branch information
RandomByte committed Jan 24, 2023
1 parent 6ac5f3e commit 7264094
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 0 deletions.
40 changes: 40 additions & 0 deletions test/lib/validation/schema/specVersion/kind/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,3 +152,43 @@ test.after.always((t) => {
}]);
});
});

test("Legacy: Special characters in name (task)", async (t) => {
await assertValidation(t, {
"specVersion": "2.0",
"kind": "extension",
"type": "task",
"metadata": {
"name": "ä".repeat(51)
},
"task": {
"path": "task.js"
}
});
});

test("Legacy: Special characters in name (server-middleware)", async (t) => {
await assertValidation(t, {
"specVersion": "2.0",
"kind": "extension",
"type": "server-middleware",
"metadata": {
"name": "@my(middleware)"
},
"middleware": {
"path": "middleware.js"
}
});
});

test("Legacy: Special characters in name (project-shim)", async (t) => {
await assertValidation(t, {
"specVersion": "2.0",
"kind": "extension",
"type": "project-shim",
"metadata": {
"name": "my/(project)-shim"
},
"shims": {}
});
});
40 changes: 40 additions & 0 deletions test/lib/validation/schema/specVersion/kind/project.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,3 +195,43 @@ test("No specVersion", async (t) => {
}
}]);
});

test("Legacy: Special characters in name (application)", async (t) => {
await assertValidation(t, {
"specVersion": "2.0",
"type": "application",
"metadata": {
"name": "/".repeat(51)
}
});
});

test("Legacy: Special characters in name (library)", async (t) => {
await assertValidation(t, {
"specVersion": "2.0",
"type": "library",
"metadata": {
"name": "my/(library)"
}
});
});

test("Legacy: Special characters in name (theme-library)", async (t) => {
await assertValidation(t, {
"specVersion": "2.0",
"type": "theme-library",
"metadata": {
"name": "my/(theme)-library"
}
});
});

test("Legacy: Special characters in name (module)", async (t) => {
await assertValidation(t, {
"specVersion": "2.0",
"type": "module",
"metadata": {
"name": "my/(module)"
}
});
});

0 comments on commit 7264094

Please sign in to comment.