Skip to content

Commit

Permalink
Fix formattin
Browse files Browse the repository at this point in the history
  • Loading branch information
msfstef committed Dec 12, 2024
1 parent c3804ef commit 49edcdd
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions packages/sync-service/test/electric/shapes/consumer_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -313,15 +313,14 @@ defmodule Electric.Shapes.ConsumerTest do

Mock.ShapeStatus
|> expect(:remove_shape, 1, fn _, @shape_handle1 -> :ok end)
|> allow(self(),Consumer.name(ctx.stack_id, @shape_handle1)
)
|> allow(self(), Consumer.name(ctx.stack_id, @shape_handle1))

shape1 = ctx.shapes[@shape_handle1]

Mock.PublicationManager
|> expect(:remove_shape, 1, fn ^shape1, _ -> :ok end)
|> expect(:remove_shape, 1, fn ^shape1, _ -> :ok end)
|> allow(self(), Consumer.name(ctx.stack_id, @shape_handle1))


txn =
%Transaction{xid: xid, lsn: lsn, last_log_offset: last_log_offset}
|> Transaction.prepend_change(%Changes.TruncatedRelation{
Expand Down Expand Up @@ -368,7 +367,6 @@ defmodule Electric.Shapes.ConsumerTest do
lsn = Lsn.from_string("0/10")
last_log_offset = LogOffset.new(lsn, 0)


Mock.ShapeStatus
|> expect(:remove_shape, fn _, @shape_handle1 -> :ok end)
|> allow(
Expand All @@ -377,8 +375,9 @@ defmodule Electric.Shapes.ConsumerTest do
)

shape = ctx.shapes[@shape_handle1]

Mock.PublicationManager
|> expect(:remove_shape, 1, fn ^shape, _ -> :ok end)
|> expect(:remove_shape, 1, fn ^shape, _ -> :ok end)
|> allow(
self(),
Shapes.Consumer.name(ctx.stack_id, @shape_handle1)
Expand Down Expand Up @@ -525,10 +524,11 @@ defmodule Electric.Shapes.ConsumerTest do

shape1 = ctx.shapes[@shape_handle1]
shape2 = ctx.shapes[@shape_handle2]

Mock.PublicationManager
|> expect(:remove_shape, 1, fn ^shape1, _ -> :ok end)
|> expect(:remove_shape, 1, fn ^shape1, _ -> :ok end)
|> allow(self(), Consumer.name(ctx.stack_id, @shape_handle1))
|> expect(:remove_shape, 0, fn ^shape2, _ -> :ok end)
|> expect(:remove_shape, 0, fn ^shape2, _ -> :ok end)
|> allow(self(), Consumer.name(ctx.stack_id, @shape_handle2))

assert :ok = ShapeLogCollector.handle_relation_msg(rel, ctx.producer)
Expand Down Expand Up @@ -574,10 +574,11 @@ defmodule Electric.Shapes.ConsumerTest do

shape1 = ctx.shapes[@shape_handle1]
shape2 = ctx.shapes[@shape_handle2]

Mock.PublicationManager
|> expect(:remove_shape, 1, fn ^shape1, _ -> :ok end)
|> expect(:remove_shape, 1, fn ^shape1, _ -> :ok end)
|> allow(self(), Consumer.name(ctx.stack_id, @shape_handle1))
|> expect(:remove_shape, 0, fn ^shape2, _ -> :ok end)
|> expect(:remove_shape, 0, fn ^shape2, _ -> :ok end)
|> allow(self(), Consumer.name(ctx.stack_id, @shape_handle2))

:ok = ShapeLogCollector.store_transaction(txn, ctx.producer)
Expand All @@ -604,10 +605,11 @@ defmodule Electric.Shapes.ConsumerTest do

shape1 = ctx.shapes[@shape_handle1]
shape2 = ctx.shapes[@shape_handle2]

Mock.PublicationManager
|> expect(:remove_shape, 1, fn ^shape1, _ -> :ok end)
|> expect(:remove_shape, 1, fn ^shape1, _ -> :ok end)
|> allow(self(), Consumer.name(ctx.stack_id, @shape_handle1))
|> expect(:remove_shape, 0, fn ^shape2, _ -> :ok end)
|> expect(:remove_shape, 0, fn ^shape2, _ -> :ok end)
|> allow(self(), Consumer.name(ctx.stack_id, @shape_handle2))

GenServer.cast(Consumer.name(ctx.stack_id, @shape_handle1), :unexpected_cast)
Expand All @@ -628,11 +630,11 @@ defmodule Electric.Shapes.ConsumerTest do
|> allow(self(), Consumer.name(ctx.stack_id, @shape_handle1))

shape1 = ctx.shapes[@shape_handle1]

Mock.PublicationManager
|> expect(:remove_shape, 0, fn ^shape1, _ -> :ok end)
|> expect(:remove_shape, 0, fn ^shape1, _ -> :ok end)
|> allow(self(), Consumer.name(ctx.stack_id, @shape_handle1))


GenServer.stop(Consumer.name(ctx.stack_id, @shape_handle1))

refute_receive {Support.TestStorage, :cleanup!, @shape_handle1}
Expand Down

0 comments on commit 49edcdd

Please sign in to comment.