Skip to content

Commit

Permalink
rename module to CID #22
Browse files Browse the repository at this point in the history
  • Loading branch information
RobStallion committed Jan 28, 2019
1 parent 0e4f639 commit 011b284
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions lib/ex_cid.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule ExCid do
defmodule Cid do
@moduledoc """
Provides a way for a user to turn a String, Map or Struct into a CID that
is identical to one what will be returned from IPFS if the same data is
Expand All @@ -16,10 +16,10 @@ defmodule ExCid do
## Examples
iex> ExCid.cid("hello")
iex> Cid.cid("hello")
"zb2rhcc1wJn2GHDLT2YkmPq5b69cXc2xfRZZmyufbjFUfBkxr"
iex> ExCid.cid(%{key: "value"})
iex> Cid.cid(%{key: "value"})
"zb2rhkN6szWhAmBFjjP8RSczv2YVNLnG1tz1Q7FyfEp8LssNZ"
"""
def cid(value) do
Expand Down
4 changes: 2 additions & 2 deletions mix.exs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
defmodule ExCid.MixProject do
defmodule Cid.MixProject do
use Mix.Project

def project do
[
app: :ex_cid,
app: :cid,
version: "0.1.0",
elixir: "~> 1.7",
start_permanent: Mix.env() == :prod,
Expand Down
10 changes: 5 additions & 5 deletions test/ex_cid_test.exs
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
defmodule ExCidTest do
use ExUnit.Case
doctest ExCid
doctest Cid

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")
assert "zb2rhkpbfTBtUV1ESqSScrUre8Hh77fhCKDLmX21rCo5xp8J9" == Cid.cid("Hello World")
end

test "ExCid.cid returns the same CID as IPFS when given a map" do
assert "zb2rhbYzyUJP6euwn89vAstfgG2Au9BSwkFGUJkbujWztZWjZ" == ExCid.cid(%{a: "a"})
assert "zb2rhbYzyUJP6euwn89vAstfgG2Au9BSwkFGUJkbujWztZWjZ" == Cid.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"})
assert "zb2rhbYzyUJP6euwn89vAstfgG2Au9BSwkFGUJkbujWztZWjZ" == Cid.cid(%__MODULE__{a: "a"})
end

test "DwylCid.cid returns an error if given invalid data type" do
assert ExCid.cid(2) == "invalid data type"
assert Cid.cid(2) == "invalid data type"
end
end
end

0 comments on commit 011b284

Please sign in to comment.