Skip to content

Commit

Permalink
adds tests #7 #11
Browse files Browse the repository at this point in the history
  • Loading branch information
RobStallion committed Jan 28, 2019
1 parent 74f3cf4 commit b17d84b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 32 deletions.
32 changes: 0 additions & 32 deletions test/dwyl_cid_test.exs

This file was deleted.

25 changes: 25 additions & 0 deletions test/ex_cid_test.exs
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

0 comments on commit b17d84b

Please sign in to comment.