-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
74f3cf4
commit b17d84b
Showing
2 changed files
with
25 additions
and
32 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,25 @@ | ||
defmodule ExCidTest do | ||
use ExUnit.Case | ||
doctest ExCid | ||
|
||
defstruct [:a] | ||
|
||
describe "Testing ex_cid function" do | ||
|
||
test "ExCid.cid returns the same CID as IPFS when given a string" do | ||
assert "zb2rhkpbfTBtUV1ESqSScrUre8Hh77fhCKDLmX21rCo5xp8J9" == ExCid.cid("Hello World") | ||
end | ||
|
||
test "ExCid.cid returns the same CID as IPFS when given a map" do | ||
assert "zb2rhbYzyUJP6euwn89vAstfgG2Au9BSwkFGUJkbujWztZWjZ" == ExCid.cid(%{a: "a"}) | ||
end | ||
|
||
test "ExCid.cid returns the same CID as IPFS when given a struct" do | ||
assert "zb2rhbYzyUJP6euwn89vAstfgG2Au9BSwkFGUJkbujWztZWjZ" == ExCid.cid(%__MODULE__{a: "a"}) | ||
end | ||
|
||
test "DwylCid.cid returns an error if given invalid data type" do | ||
assert ExCid.cid(2) == "invalid data type" | ||
end | ||
end | ||
end |