Skip to content

Commit

Permalink
add: some test case
Browse files Browse the repository at this point in the history
  • Loading branch information
d-tsuji committed Apr 24, 2020
1 parent a369e7b commit 4253057
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions broker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,19 @@ func Test_fetchRemoteArticle(t *testing.T) {
}
}

func Test_fetchRemoteArticleNoID(t *testing.T) {
broker, _, _, teardown := setup()
defer teardown()

_, err := broker.fetchRemoteArticle(&Article{
ArticleHeader: &ArticleHeader{ID: ""},
})
if err == nil {
t.Errorf("expected error occured if no article ID")
return
}
}

func Test_fetchRemoteArticles(t *testing.T) {
broker, mux, _, teardown := setup()
t.Cleanup(func() {
Expand Down Expand Up @@ -814,6 +827,17 @@ func TestPatchArticle(t *testing.T) {
}
}

func TestPatchArticleNoID(t *testing.T) {
broker, _, _, teardown := setup()
defer teardown()

err := broker.patchArticle(&PostItem{ID: ""})
if err == nil {
t.Errorf("expected error occured if no article ID")
return
}
}

func Test_fetchLocalArticles(t *testing.T) {
updateAt := time.Date(2020, 4, 22, 16, 59, 59, 0, time.UTC)

Expand Down

0 comments on commit 4253057

Please sign in to comment.