Skip to content

Commit

Permalink
fix: test data in unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
leoadonia committed Sep 13, 2024
1 parent 21926d3 commit 23795a8
Show file tree
Hide file tree
Showing 28 changed files with 529 additions and 499 deletions.
28 changes: 8 additions & 20 deletions core/src/ten_manager/src/dev_server/addons/extensions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,34 +172,22 @@ mod tests {

let all_pkgs_json = vec![
(
include_str!(
"../test_data_embed/large_response_source_app_manifest.json"
)
.to_string(),
include_str!(
"../test_data_embed/large_response_source_app_property.json"
)
.to_string(),
include_str!("test_data_embed/app_manifest.json").to_string(),
include_str!("test_data_embed/app_property.json").to_string(),
),
(
include_str!(
"../test_data_embed/extension_addon_1_manifest.json"
)
.to_string(),
include_str!("test_data_embed/extension_addon_1_manifest.json")
.to_string(),
"{}".to_string(),
),
(
include_str!(
"../test_data_embed/extension_addon_2_manifest.json"
)
.to_string(),
include_str!("test_data_embed/extension_addon_2_manifest.json")
.to_string(),
"{}".to_string(),
),
(
include_str!(
"../test_data_embed/extension_addon_3_manifest.json"
)
.to_string(),
include_str!("test_data_embed/extension_addon_3_manifest.json")
.to_string(),
"{}".to_string(),
),
];
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"type": "app",
"name": "test_get_addons",
"version": "0.1.0",
"dependencies": [
{
"type": "system",
"name": "ten_runtime",
"version": "0.2.0"
},
{
"type": "extension",
"name": "extension_addon_1",
"version": "0.1.0"
},
{
"type": "extension",
"name": "extension_addon_2",
"version": "0.1.0"
},
{
"type": "extension",
"name": "extension_addon_3",
"version": "0.1.0"
},
{
"type": "extension_group",
"name": "default_extension_group",
"version": "0.1.0"
}
]
}
36 changes: 12 additions & 24 deletions core/src/ten_manager/src/dev_server/graphs/connections.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,34 +192,22 @@ mod tests {

let all_pkgs_json = vec![
(
include_str!(
"../test_data_embed/large_response_source_app_manifest.json"
)
.to_string(),
include_str!(
"../test_data_embed/large_response_source_app_property.json"
)
.to_string(),
include_str!("test_data_embed/app_manifest.json").to_string(),
include_str!("test_data_embed/app_property.json").to_string(),
),
(
include_str!(
"../test_data_embed/extension_addon_1_manifest.json"
)
.to_string(),
include_str!("test_data_embed/extension_addon_1_manifest.json")
.to_string(),
"{}".to_string(),
),
(
include_str!(
"../test_data_embed/extension_addon_2_manifest.json"
)
.to_string(),
include_str!("test_data_embed/extension_addon_2_manifest.json")
.to_string(),
"{}".to_string(),
),
(
include_str!(
"../test_data_embed/extension_addon_3_manifest.json"
)
.to_string(),
include_str!("test_data_embed/extension_addon_3_manifest.json")
.to_string(),
"{}".to_string(),
),
];
Expand Down Expand Up @@ -288,18 +276,18 @@ mod tests {
// 'property.json'.
let all_pkgs_json = vec![
(
include_str!("test_data_embed/all_data_type_app_manifest.json")
include_str!("test_data_embed/get_connections_have_all_data_type/app_manifest.json")
.to_string(),
include_str!("test_data_embed/all_data_type_app_property.json")
include_str!("test_data_embed/get_connections_have_all_data_type/app_property.json")
.to_string(),
),
(
include_str!("test_data_embed/extension_addon_1_manifest.json")
include_str!("test_data_embed/get_connections_have_all_data_type/extension_addon_1_manifest.json")
.to_string(),
"{}".to_string(),
),
(
include_str!("test_data_embed/extension_addon_2_manifest.json")
include_str!("test_data_embed/get_connections_have_all_data_type/extension_addon_2_manifest.json")
.to_string(),
"{}".to_string(),
),
Expand Down
28 changes: 8 additions & 20 deletions core/src/ten_manager/src/dev_server/graphs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,34 +98,22 @@ mod tests {

let all_pkgs_json = vec![
(
include_str!(
"../test_data_embed/large_response_source_app_manifest.json"
)
.to_string(),
include_str!(
"../test_data_embed/large_response_source_app_property.json"
)
.to_string(),
include_str!("test_data_embed/app_manifest.json").to_string(),
include_str!("test_data_embed/app_property.json").to_string(),
),
(
include_str!(
"../test_data_embed/extension_addon_1_manifest.json"
)
.to_string(),
include_str!("test_data_embed/extension_addon_1_manifest.json")
.to_string(),
"{}".to_string(),
),
(
include_str!(
"../test_data_embed/extension_addon_2_manifest.json"
)
.to_string(),
include_str!("test_data_embed/extension_addon_2_manifest.json")
.to_string(),
"{}".to_string(),
),
(
include_str!(
"../test_data_embed/extension_addon_3_manifest.json"
)
.to_string(),
include_str!("test_data_embed/extension_addon_3_manifest.json")
.to_string(),
"{}".to_string(),
),
];
Expand Down
56 changes: 16 additions & 40 deletions core/src/ten_manager/src/dev_server/graphs/nodes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -375,34 +375,22 @@ mod tests {

let all_pkgs_json = vec![
(
include_str!(
"../test_data_embed/large_response_source_app_manifest.json"
)
.to_string(),
include_str!(
"../test_data_embed/large_response_source_app_property.json"
)
.to_string(),
include_str!("test_data_embed/app_manifest.json").to_string(),
include_str!("test_data_embed/app_property.json").to_string(),
),
(
include_str!(
"../test_data_embed/extension_addon_1_manifest.json"
)
.to_string(),
include_str!("test_data_embed/extension_addon_1_manifest.json")
.to_string(),
"{}".to_string(),
),
(
include_str!(
"../test_data_embed/extension_addon_2_manifest.json"
)
.to_string(),
include_str!("test_data_embed/extension_addon_2_manifest.json")
.to_string(),
"{}".to_string(),
),
(
include_str!(
"../test_data_embed/extension_addon_3_manifest.json"
)
.to_string(),
include_str!("test_data_embed/extension_addon_3_manifest.json")
.to_string(),
"{}".to_string(),
),
];
Expand Down Expand Up @@ -652,34 +640,22 @@ mod tests {

let all_pkgs_json = vec![
(
include_str!(
"../test_data_embed/large_response_source_app_manifest.json"
)
.to_string(),
include_str!(
"../test_data_embed/large_response_source_app_property.json"
)
.to_string(),
include_str!("test_data_embed/app_manifest.json").to_string(),
include_str!("test_data_embed/app_property.json").to_string(),
),
(
include_str!(
"../test_data_embed/extension_addon_1_manifest.json"
)
.to_string(),
include_str!("test_data_embed/extension_addon_1_manifest.json")
.to_string(),
"{}".to_string(),
),
(
include_str!(
"../test_data_embed/extension_addon_2_manifest.json"
)
.to_string(),
include_str!("test_data_embed/extension_addon_2_manifest.json")
.to_string(),
"{}".to_string(),
),
(
include_str!(
"../test_data_embed/extension_addon_3_manifest.json"
)
.to_string(),
include_str!("test_data_embed/extension_addon_3_manifest.json")
.to_string(),
"{}".to_string(),
),
];
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"_ten": {
"predefined_graphs": [
{
"name": "0",
"auto_start": true,
"nodes": [
{
"type": "extension",
"name": "extension_1",
"addon": "extension_addon_1",
"extension_group": "extension_group_1"
},
{
"type": "extension",
"name": "extension_2",
"addon": "extension_addon_2",
"extension_group": "extension_group_1",
"property": {
"a": 1
}
},
{
"type": "extension",
"name": "extension_3",
"addon": "extension_addon_3",
"extension_group": "extension_group_1"
}
],
"connections": [
{
"extension_group": "extension_group_1",
"extension": "extension_1",
"cmd": [
{
"name": "hello_world",
"dest": [
{
"extension_group": "extension_group_1",
"extension": "extension_2"
}
]
}
]
}
]
},
{
"name": "addon_not_found",
"auto_start": false,
"nodes": [
{
"type": "extension_group",
"name": "default",
"addon": "default_extension_group"
},
{
"type": "extension",
"name": "extension_1",
"addon": "extension_addon_1_not_found",
"extension_group": "default"
}
]
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,39 @@
"name": "ten_runtime",
"version": "0.2.0"
}
]
],
"api": {
"cmd_out": [
{
"name": "test_cmd",
"property": {
"test_property": {
"type": "int8"
}
}
},
{
"name": "has_required",
"property": {
"foo": {
"type": "string"
}
},
"required": [
"foo"
]
},
{
"name": "has_required_mismatch",
"property": {
"foo": {
"type": "string"
}
},
"required": [
"foo"
]
}
]
}
}
Loading

0 comments on commit 23795a8

Please sign in to comment.