-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"activeTab": 4 | ||
"activeTab": 5 | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"TabSet1": 2, | ||
"TabSet1": 5, | ||
"TabSet2": 1, | ||
"TabZoom": {} | ||
} |
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"source_window_id": "", | ||
"Source": "Source", | ||
"cursorPosition": "29,0", | ||
"scrollLine": "15" | ||
"cursorPosition": "6,11", | ||
"scrollLine": "0" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"source_window_id": "", | ||
"Source": "Source", | ||
"cursorPosition": "8,1", | ||
"scrollLine": "0" | ||
"cursorPosition": "42,3", | ||
"scrollLine": "15" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"source_window_id": "", | ||
"Source": "Source", | ||
"cursorPosition": "27,10", | ||
"scrollLine": "6" | ||
"cursorPosition": "30,9", | ||
"scrollLine": "18" | ||
} |
This file was deleted.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
test_that("get_ly_committees_type basic functionality", { | ||
# 測試基本呼叫 | ||
result <- get_ly_committees_type(show_progress = FALSE) | ||
|
||
# 檢查回傳值結構 | ||
expect_type(result, "list") | ||
|
||
# 檢查資料框結構 | ||
expect_s3_class(result$committees, "data.frame") | ||
expect_named(result$committees, c("代號", "名稱", "職掌", "類別")) | ||
}) | ||
|
||
test_that("get_ly_committees_type handles parameters correctly", { | ||
# 測試特定參數 | ||
result <- get_ly_committees_type( | ||
page = 1, | ||
per_page = 10, | ||
type = "常設委員會", | ||
show_progress = FALSE | ||
) | ||
|
||
# 檢查分頁設定 | ||
expect_equal(result$metadata$current_page, 1) | ||
expect_equal(result$metadata$per_page, 100) | ||
|
||
# 檢查委員會類別 | ||
if(nrow(result$committees) > 0) { | ||
expect_equal(unique(result$committees$類別), "常設委員會") | ||
} | ||
}) | ||
|
||
test_that("get_ly_committees_type error handling", { | ||
# 測試錯誤參數 | ||
expect_error( | ||
get_ly_committees_type(page = "invalid", show_progress = FALSE), | ||
"API request failed with status code: 500" | ||
) | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
test_that("parameter validation works", { | ||
# 測試缺少必要參數 | ||
expect_error( | ||
get_ly_legislator_detail(name = "王金平", show_progress = FALSE), | ||
"term parameter is required" | ||
) | ||
|
||
expect_error( | ||
get_ly_legislator_detail(term = 9, show_progress = FALSE), | ||
"name parameter is required" | ||
) | ||
|
||
# 測試參數型別錯誤 | ||
expect_error( | ||
get_ly_legislator_detail(term = "9", name = "王金平", show_progress = FALSE), | ||
"term must be numeric" | ||
) | ||
|
||
expect_error( | ||
get_ly_legislator_detail(term = 9, name = 123, show_progress = FALSE), | ||
"name must be character" | ||
) | ||
}) | ||
|
||
test_that("basic functionality works", { | ||
# 測試基本功能 | ||
result <- get_ly_legislator_detail( | ||
term = 9, | ||
name = "王金平", | ||
show_progress = FALSE | ||
) | ||
|
||
# 檢查回傳值結構 | ||
expect_type(result, "list") | ||
|
||
# 檢查必要欄位 | ||
expected_fields <- c( | ||
"term", "name", "party", | ||
"areaName", "partyGroup" | ||
) | ||
|
||
for(field in expected_fields) { | ||
expect_true( | ||
field %in% names(result), | ||
info = sprintf("Field '%s' should exist in result", field) | ||
) | ||
} | ||
|
||
# 檢查資料內容 | ||
expect_equal(result$term, 9) | ||
expect_equal(result$name, "王金平") | ||
}) | ||
|
||
test_that("invalid term/name combination returns error", { | ||
expect_error( | ||
get_ly_legislator_detail( | ||
term = 999, | ||
name = "不存在的立委", | ||
show_progress = FALSE | ||
), | ||
"API request failed with status code: " | ||
) | ||
}) |