Files
metabuilder/packages/data_table/tests/sorting.test.json
johndoe6345789 ef709d47c0 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.
2026-01-02 21:25:45 +00:00

115 lines
3.5 KiB
JSON

{
"$schema": "https://metabuilder.dev/schemas/tests.schema.json",
"schemaVersion": "2.0.0",
"package": "data_table",
"description": "Table sorting functionality tests",
"testSuites": [
{
"id": "sorting-functionality",
"name": "Sorting Functionality Tests",
"description": "Test column sorting in ascending and descending order",
"tags": ["sorting", "functionality"],
"tests": [
{
"id": "test-sort-ascending",
"name": "should sort data in ascending order",
"parameterized": true,
"parameters": [
{
"case": "sort names alphabetically",
"input": {
"data": [
{ "id": 1, "name": "Charlie", "age": 30 },
{ "id": 2, "name": "Alice", "age": 25 },
{ "id": 3, "name": "Bob", "age": 35 }
],
"column": "name",
"direction": "asc"
},
"expected": [2, 3, 1]
},
{
"case": "sort numbers ascending",
"input": {
"data": [
{ "id": 1, "name": "Alice", "age": 30 },
{ "id": 2, "name": "Bob", "age": 25 },
{ "id": 3, "name": "Charlie", "age": 35 }
],
"column": "age",
"direction": "asc"
},
"expected": [2, 1, 3]
}
],
"act": {
"type": "function_call",
"target": "sorting.sortByColumn",
"input": "{{input}}"
},
"assert": {
"expectations": [
{
"type": "deepEquals",
"actual": "result.map(row => row.id)",
"expected": "{{expected}}",
"description": "Sorted order should match expected"
}
]
}
},
{
"id": "test-sort-descending",
"name": "should sort data in descending order",
"parameterized": true,
"parameters": [
{
"case": "sort names reverse alphabetically",
"input": {
"data": [
{ "id": 1, "name": "Alice", "age": 25 },
{ "id": 2, "name": "Bob", "age": 30 },
{ "id": 3, "name": "Charlie", "age": 35 }
],
"column": "name",
"direction": "desc"
},
"expected": [3, 2, 1]
},
{
"case": "sort numbers descending",
"input": {
"data": [
{ "id": 1, "name": "Alice", "age": 25 },
{ "id": 2, "name": "Bob", "age": 30 },
{ "id": 3, "name": "Charlie", "age": 35 }
],
"column": "age",
"direction": "desc"
},
"expected": [3, 2, 1]
}
],
"act": {
"type": "function_call",
"target": "sorting.sortByColumn",
"input": "{{input}}"
},
"assert": {
"expectations": [
{
"type": "deepEquals",
"actual": "result.map(row => row.id)",
"expected": "{{expected}}",
"description": "Sorted order should match expected"
}
]
}
}
]
}
]
}