refactor: update testing framework and restructure test configurations

- Changed devDependencies from "lua_test" to "testing" in package.json for ui_level4, ui_level5, ui_level6, ui_login, ui_pages, ui_permissions, user_manager, and workflow_editor.
- Removed legacy test scripts and parameterized tests, replacing them with a unified test suite structure in the tests section of package.json.
- Introduced new metadata.params.json files for each package to define test parameters for package ID validation, icon file existence, and JSON schema validation.
- Created new metadata.test.json files for each package to define structured test cases for validating package metadata, including checks for package ID, icon file existence, and schema validity.
This commit is contained in:
2026-01-02 21:25:45 +00:00
parent e69b166046
commit ef709d47c0
141 changed files with 6420 additions and 530 deletions

View File

@@ -12,7 +12,7 @@
"primary": false,
"dependencies": {},
"devDependencies": {
"lua_test": "*"
"testing": "*"
},
"exports": {
"components": [

View File

@@ -0,0 +1,49 @@
{
"$schema": "https://metabuilder.dev/schemas/test-parameters.schema.json",
"schemaVersion": "2.0.0",
"package": "json_script_example",
"description": "Test parameters for metadata validation",
"parameters": [
{
"id": "package-id-params",
"name": "Package ID Test Parameters",
"description": "Parameters for testing package ID validation",
"tags": ["metadata", "validation"],
"params": {
"packageId": {
"type": "string",
"description": "Expected package ID"
}
}
},
{
"id": "icon-file-params",
"name": "Icon File Test Parameters",
"description": "Parameters for testing icon file existence",
"tags": ["metadata", "assets"],
"params": {
"iconPath": {
"type": "string",
"description": "Path to icon file relative to packages directory"
}
}
},
{
"id": "schema-validation-params",
"name": "Schema Validation Test Parameters",
"description": "Parameters for JSON schema validation",
"tags": ["metadata", "schema"],
"params": {
"filePath": {
"type": "string",
"description": "Path to file to validate"
},
"schemaUrl": {
"type": "string",
"description": "URL of JSON schema to validate against"
}
}
}
]
}

View File

@@ -0,0 +1,76 @@
{
"$schema": "https://metabuilder.dev/schemas/tests.schema.json",
"schemaVersion": "2.0.0",
"package": "json_script_example",
"description": "Package metadata validation tests",
"testSuites": [
{
"id": "package-metadata",
"name": "Package Metadata Tests",
"description": "Validate package.json metadata structure and values",
"tags": ["metadata", "validation"],
"tests": [
{
"id": "test-package-id",
"name": "should have correct packageId",
"act": {
"type": "function_call",
"target": "getPackageMetadata",
"input": "json_script_example"
},
"assert": {
"expectations": [
{
"type": "equals",
"actual": "result.packageId",
"expected": "json_script_example",
"description": "Package ID should match"
}
]
}
},
{
"id": "test-icon-exists",
"name": "should have an icon file",
"act": {
"type": "function_call",
"target": "checkFileExists",
"input": "json_script_example/static_content/icon.svg"
},
"assert": {
"expectations": [
{
"type": "truthy",
"actual": "result",
"description": "Icon file should exist"
}
]
}
},
{
"id": "test-schema-valid",
"name": "package.json should be valid against schema",
"act": {
"type": "function_call",
"target": "validateAgainstSchema",
"input": {
"file": "json_script_example/package.json",
"schema": "https://metabuilder.dev/schemas/package-metadata.schema.json"
}
},
"assert": {
"expectations": [
{
"type": "truthy",
"actual": "result.valid",
"description": "package.json should be valid"
}
]
}
}
]
}
]
}