Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Pleroma
pleroma
Commits
50bf1746
Commit
50bf1746
authored
Nov 06, 2018
by
kaniini
Browse files
tests: add tests for Notification.set_read_up_to()
parent
f16c2e0b
Changes
1
Hide whitespace changes
Inline
Side-by-side
test/notification_test.exs
View file @
50bf1746
...
...
@@ -121,6 +121,41 @@ test "it clears all notifications belonging to the user" do
end
end
describe
"set_read_up_to()"
do
test
"it sets all notifications as read up to a specified notification ID"
do
user
=
insert
(
:user
)
other_user
=
insert
(
:user
)
{
:ok
,
activity
}
=
TwitterAPI
.
create_status
(
user
,
%{
"status"
=>
"hey @
#{
other_user
.
nickname
}
!"
})
{
:ok
,
activity
}
=
TwitterAPI
.
create_status
(
user
,
%{
"status"
=>
"hey again @
#{
other_user
.
nickname
}
!"
})
[
n2
,
n1
]
=
notifs
=
Notification
.
for_user
(
other_user
)
assert
length
(
notifs
)
==
2
assert
n2
.
id
>
n1
.
id
{
:ok
,
activity
}
=
TwitterAPI
.
create_status
(
user
,
%{
"status"
=>
"hey yet again @
#{
other_user
.
nickname
}
!"
})
Notification
.
set_read_up_to
(
other_user
,
n2
.
id
)
[
n3
,
n2
,
n1
]
=
notifs
=
Notification
.
for_user
(
other_user
)
assert
n1
.
seen
==
true
assert
n2
.
seen
==
true
assert
n3
.
seen
==
false
end
end
describe
"notification lifecycle"
do
test
"liking an activity results in 1 notification, then 0 if the activity is deleted"
do
user
=
insert
(
:user
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment