File tree Expand file tree Collapse file tree 1 file changed +14
-8
lines changed
test/nostrum/cache/message_cache Expand file tree Collapse file tree 1 file changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -151,26 +151,32 @@ defmodule Nostrum.Cache.MessageCache.MnesiaAdditionalTest do
151151 end
152152
153153 describe "bulk_delete/2" do
154- test "returns the deleted messages when they are found in the cache" do
155- expected_messages = [
154+ setup do
155+ messages = [
156156 MessageCache.Mnesia . create ( @ test_message ) ,
157157 MessageCache.Mnesia . create ( % { @ test_message_two | channel_id: @ test_message . channel_id } )
158158 ]
159159
160- assert expected_messages ==
160+ [ messages: messages ]
161+ end
162+
163+ test "returns the deleted messages when they are found in the cache" , % { messages: messages } do
164+ assert messages ==
161165 MessageCache.Mnesia . bulk_delete ( @ test_message . channel_id , [
162166 @ test_message . id ,
163167 @ test_message_two . id
164168 ] )
165169 end
166170
167- test "does not include messages not found in the cache in the returned list" do
168- expected_message = MessageCache.Mnesia . create ( @ test_message )
171+ test "does not include messages not found in the cache in the returned list" , % {
172+ messages: messages
173+ } do
174+ [ first , second ] = messages
169175
170- assert [ expected_message ] = =
176+ assert [ ^ first ] =
171177 MessageCache.Mnesia . bulk_delete ( @ test_message . channel_id , [
172- @ test_message . id ,
173- @ test_message_two . id
178+ first . id ,
179+ second . id + 1234
174180 ] )
175181 end
176182 end
You can’t perform that action at this time.
0 commit comments