Skip to content

Commit 37e9357

Browse files
fix: inconsistent test (#64)
1 parent 8bee2d6 commit 37e9357

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

api/handlers/type_handler.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ func (h *TypeHandler) Get(w http.ResponseWriter, r *http.Request) {
3737
}
3838

3939
results := []TypeWithCount{}
40-
for typName, count := range typesNameMap {
40+
for _, typName := range record.AllSupportedTypes {
41+
count, _ := typesNameMap[typName]
4142
results = append(results, TypeWithCount{
4243
Name: typName.String(),
4344
Count: count,

api/handlers/type_handler_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,9 @@ func TestTypeHandler(t *testing.T) {
5656

5757
expected, err := json.Marshal([]map[string]interface{}{
5858
{"name": "table", "count": 10},
59-
{"name": "topic", "count": 30},
6059
{"name": "job", "count": 15},
60+
{"name": "dashboard", "count": 0},
61+
{"name": "topic", "count": 30},
6162
})
6263
require.NoError(t, err)
6364

0 commit comments

Comments
 (0)