forked from mana-ethereum/ethereumex
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: provide configuration for locked id response value
- Loading branch information
Ino Murko
committed
Oct 20, 2019
1 parent
6490752
commit b79c88e
Showing
3 changed files
with
50 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
defmodule Ethereumex.CounterLockTest do | ||
use ExUnit.Case | ||
alias Ethereumex.Counter | ||
|
||
setup do | ||
Application.put_env(:ethereumex, :id_lock, "0") | ||
|
||
on_exit(fn -> | ||
Application.put_env(:ethereumex, :id_lock, nil) | ||
end) | ||
end | ||
|
||
test "incrementing twice returns correct locked binary" do | ||
"0" = Counter.increment(:test_1) | ||
"0" = Counter.increment(:test_1) | ||
end | ||
|
||
test "incrementing twice and updating with a count returns correct locked binary" do | ||
"0" = Counter.increment(:test_2) | ||
"0" = Counter.increment(:test_2, 2) | ||
end | ||
|
||
test "incrementing twice, updating with a count and incrementing again returns correct locked binary" do | ||
"0" = Counter.increment(:test_3) | ||
"0" = Counter.increment(:test_3, 2) | ||
"0" = Counter.increment(:test_3) | ||
end | ||
end |