Skip to content

Commit 5d3e62f

Browse files
authored
chore(backend): pin dates to fix flaky tests 🙏 (#706)
1 parent 64b4725 commit 5d3e62f

File tree

2 files changed

+42
-28
lines changed

2 files changed

+42
-28
lines changed

backend/timed/tracking/tests/__snapshots__/test_report.ambr

+23-23
Original file line numberDiff line numberDiff line change
@@ -40,33 +40,44 @@
4040
Reviewer: Test User
4141

4242

43-
Date: 04 March 1975
44-
Duration: 3:15 (h:mm)
43+
Date: 01 January 2022
44+
Duration: 1:00 (h:mm)
45+
Task: Brown LLC > Synchronized impactful attitude > LLC
46+
47+
48+
* Comment
49+
[old] original comment
50+
[new] some other comment
4551

52+
---
4653

54+
Date: 01 February 2022
55+
Duration: 2:30 (h:mm)
56+
57+
Comment: some other comment
4758

4859
* Task
49-
[old] Brown LLC > Synchronized impactful attitude > LLC
60+
[old] Brown LLC > Synchronized impactful attitude > and Sons
5061
[new] Brown LLC > Synchronized impactful attitude > LLC
5162

52-
* Comment
53-
[old] foo
54-
[new] some other comment
55-
5663
---
5764

58-
Date: 10 May 1993
59-
Duration: 1:00 (h:mm)
60-
Task: Brown LLC > Synchronized impactful attitude > LLC
65+
Date: 01 March 2022
66+
Duration: 3:15 (h:mm)
67+
6168

6269

70+
* Task
71+
[old] Brown LLC > Synchronized impactful attitude > LLC
72+
[new] Brown LLC > Synchronized impactful attitude > LLC
73+
6374
* Comment
64-
[old] original comment
75+
[old] foo
6576
[new] some other comment
6677

6778
---
6879

69-
Date: 27 August 1996
80+
Date: 01 March 2022
7081
Duration: 0:15 (h:mm)
7182
Task: Brown LLC > Synchronized impactful attitude > LLC
7283
Comment: some other comment
@@ -77,16 +88,5 @@
7788

7889
---
7990

80-
Date: 03 September 1998
81-
Duration: 2:30 (h:mm)
82-
83-
Comment: some other comment
84-
85-
* Task
86-
[old] Brown LLC > Synchronized impactful attitude > and Sons
87-
[new] Brown LLC > Synchronized impactful attitude > LLC
88-
89-
---
90-
9191
'''
9292
# ---

backend/timed/tracking/tests/test_report.py

+19-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Tests for the reports endpoint."""
22

3-
from datetime import timedelta
3+
from datetime import date, timedelta
44

55
import pyexcel
66
import pytest
@@ -1386,14 +1386,28 @@ def test_report_notify_rendering(
13861386
task1, task2, task3 = task_factory.create_batch(3, project=project)
13871387

13881388
report1 = report_factory(
1389-
user=user, task=task1, comment="original comment", not_billable=False
1389+
user=user,
1390+
task=task1,
1391+
comment="original comment",
1392+
not_billable=False,
1393+
date=date(2022, 1, 1),
13901394
)
13911395
report2 = report_factory(
1392-
user=user, task=task2, comment="some other comment", not_billable=False
1396+
user=user,
1397+
task=task2,
1398+
comment="some other comment",
1399+
not_billable=False,
1400+
date=date(2022, 2, 1),
1401+
)
1402+
report3 = report_factory(
1403+
user=user, task=task3, comment="foo", not_billable=False, date=date(2022, 3, 1)
13931404
)
1394-
report3 = report_factory(user=user, task=task3, comment="foo", not_billable=False)
13951405
report4 = report_factory(
1396-
user=user, task=task1, comment=report2.comment, not_billable=True
1406+
user=user,
1407+
task=task1,
1408+
comment=report2.comment,
1409+
not_billable=True,
1410+
date=date(2022, 3, 1),
13971411
)
13981412

13991413
data = {

0 commit comments

Comments
 (0)