Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commit9179c5d

Browse files
committed
fix time-boundary issue
1 parente1840d0 commit9179c5d

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

‎test/mastani_server_web/query/paged_posts_test.exs‎

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ defmodule MastaniServer.Test.Query.PagedPostsTest do
1313

1414
@cur_dateTimex.now()
1515
@last_weekTimex.shift(Timex.beginning_of_week(@cur_date),days:-1)
16-
@last_monthTimex.shift(Timex.beginning_of_month(@cur_date),days:-1)
16+
@last_monthTimex.shift(Timex.beginning_of_month(@cur_date),days:-2)
1717
@last_yearTimex.shift(Timex.beginning_of_year(@cur_date),days:-1)
1818

1919
@posts_today_count35
@@ -166,17 +166,31 @@ defmodule MastaniServer.Test.Query.PagedPostsTest do
166166
assertresults|>Map.get("totalCount")==expect_count
167167
end
168168

169+
@tag:wip
169170
test"THIS_WEEK option should work",~m(guest_conn)ado
170171
variables=%{filter:%{when:"THIS_WEEK"}}
171172
results=guest_conn|>query_result(@query,variables,"pagedPosts")
173+
172174
assertresults|>Map.get("totalCount")==@posts_today_count
173175
end
174176

175177
test"THIS_MONTH option should work",~m(guest_conn)ado
176178
variables=%{filter:%{when:"THIS_MONTH"}}
177179
results=guest_conn|>query_result(@query,variables,"pagedPosts")
178180

179-
expect_count=@posts_total_count-@posts_last_year_count-@posts_last_month_count
181+
{_,cur_week_month,_}=@cur_date|>Date.to_erl()
182+
{_,last_week_month,_}=@last_week|>Date.to_erl()
183+
184+
expect_count=
185+
casecur_week_month==last_week_monthdo
186+
true->
187+
@posts_total_count-@posts_last_year_count-@posts_last_month_count
188+
189+
false->
190+
@posts_total_count-@posts_last_year_count-@posts_last_month_count-
191+
@posts_last_week_count
192+
end
193+
180194
assertresults|>Map.get("totalCount")==expect_count
181195
end
182196
end

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp