From 3059909deb5e21746d3d95e4989a78db51ccec33 Mon Sep 17 00:00:00 2001 From: Brian Picciano Date: Sat, 21 May 2022 11:15:37 -0600 Subject: Publish new posts to mailing list --- srv/src/post/post_test.go | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'srv/src/post/post_test.go') diff --git a/srv/src/post/post_test.go b/srv/src/post/post_test.go index b6d8a2e..c7f9cdc 100644 --- a/srv/src/post/post_test.go +++ b/srv/src/post/post_test.go @@ -108,7 +108,9 @@ func TestStore(t *testing.T) { post := testPost(0) post.Tags = []string{"foo", "bar"} - assert.NoError(t, h.store.Set(post, now)) + first, err := h.store.Set(post, now) + assert.NoError(t, err) + assert.True(t, first) gotPost, err := h.store.GetByID(post.ID) assert.NoError(t, err) @@ -129,7 +131,9 @@ func TestStore(t *testing.T) { post.Body = "anything" post.Tags = []string{"bar", "baz"} - assert.NoError(t, h.store.Set(post, newNow)) + first, err = h.store.Set(post, newNow) + assert.NoError(t, err) + assert.False(t, first) gotPost, err = h.store.GetByID(post.ID) assert.NoError(t, err) @@ -160,7 +164,8 @@ func TestStore(t *testing.T) { } for _, post := range posts { - assert.NoError(t, h.store.Set(post.Post, now)) + _, err := h.store.Set(post.Post, now) + assert.NoError(t, err) } gotPosts, hasMore, err := h.store.Get(0, 2) @@ -174,7 +179,8 @@ func TestStore(t *testing.T) { assertPostsEqual(t, posts[2:4], gotPosts) posts = append([]StoredPost{h.testStoredPost(4)}, posts...) - assert.NoError(t, h.store.Set(posts[0].Post, now)) + _, err = h.store.Set(posts[0].Post, now) + assert.NoError(t, err) gotPosts, hasMore, err = h.store.Get(1, 2) assert.NoError(t, err) @@ -204,7 +210,8 @@ func TestStore(t *testing.T) { posts[2].Series = "bar" for _, post := range posts { - assert.NoError(t, h.store.Set(post.Post, now)) + _, err := h.store.Set(post.Post, now) + assert.NoError(t, err) } fooPosts, err := h.store.GetBySeries("foo") @@ -238,7 +245,8 @@ func TestStore(t *testing.T) { posts[2].Tags = []string{"bar"} for _, post := range posts { - assert.NoError(t, h.store.Set(post.Post, now)) + _, err := h.store.Set(post.Post, now) + assert.NoError(t, err) } fooPosts, err := h.store.GetByTag("foo") -- cgit v1.2.3