Skip to content

Commit

Permalink
add more tests for image dominant color #221
Browse files Browse the repository at this point in the history
  • Loading branch information
nelsonic committed Jan 16, 2025
1 parent a9708d7 commit b2bd894
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/app/repository.ex
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ defmodule App.Repository do
def get_org_repos(org) do
App.GitHub.org_repos(org)
|> Enum.map(fn repo ->
dbg(repo)
create(repo)
end)
end
Expand Down
9 changes: 9 additions & 0 deletions test/app/image_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,20 @@ defmodule App.ImgTest do
url2 = "https://avatars.githubusercontent.com/u/194400"
img_data2 = Img.get_raw_image_data(url2)
assert Img.extract_color(img_data2) == "F80818"

url3 = "https://avatars.githubusercontent.com/u/19310512"
img_data3 = Img.get_raw_image_data(url3)
assert Img.extract_color(img_data3) == "080808"
end

test "App.Img.get_avatar_color/1 gets the hex color for avatar" do
avatar_url = "https://avatars.githubusercontent.com/u/4185328"
assert Img.get_avatar_color(avatar_url) == "F8F8F8"

avatar_url2 = "https://avatars.githubusercontent.com/u/7805691"
assert Img.get_avatar_color(avatar_url2) == "C85878"
# https://github.com/harrygfox
# https://www.color-hex.com/color/c85878
end

test "to_hex/1 returns the hex value of an integer" do
Expand Down

0 comments on commit b2bd894

Please sign in to comment.