|
|
|
@ -16,15 +16,23 @@ defmodule DecentralisedBookIndex.Sync.DataTransformers.AuthorSyncTest do
|
|
|
|
|
name: "Author",
|
|
|
|
|
description: "Something",
|
|
|
|
|
avatar_url: "/images/avatar.png",
|
|
|
|
|
author_alias_registry_id: nil
|
|
|
|
|
author_alias_registry_id: nil,
|
|
|
|
|
inserted_at: "2025-03-21T09:20:48.791539Z",
|
|
|
|
|
updated_at: "2025-03-21T09:20:48.791539Z"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{:ok, inserted_at, 0} = DateTime.from_iso8601(author[:inserted_at])
|
|
|
|
|
{:ok, updated_at, 0} = DateTime.from_iso8601(author[:updated_at])
|
|
|
|
|
|
|
|
|
|
assert :ok = AuthorSync.create_update(author, server.id)
|
|
|
|
|
assert {:ok, saved_author} = Metadata.get_author_by_id(author.id)
|
|
|
|
|
|
|
|
|
|
assert author.id == saved_author.id
|
|
|
|
|
assert author.name == saved_author.name
|
|
|
|
|
assert author.avatar_url == saved_author.avatar_url
|
|
|
|
|
author =
|
|
|
|
|
author
|
|
|
|
|
|> Map.replace(:inserted_at, inserted_at)
|
|
|
|
|
|> Map.replace(:updated_at, updated_at)
|
|
|
|
|
|
|
|
|
|
assert author = saved_author
|
|
|
|
|
assert nil != saved_author.author_alias_registry_id
|
|
|
|
|
assert server.id == saved_author.dbi_server_id
|
|
|
|
|
end
|
|
|
|
@ -45,10 +53,7 @@ defmodule DecentralisedBookIndex.Sync.DataTransformers.AuthorSyncTest do
|
|
|
|
|
assert :ok = AuthorSync.create_update(author_attrs, server.id)
|
|
|
|
|
assert {:ok, saved_author} = Metadata.get_author_by_id(author.id)
|
|
|
|
|
|
|
|
|
|
assert author.id == saved_author.id
|
|
|
|
|
assert author_attrs.name == saved_author.name
|
|
|
|
|
assert author_attrs.description == saved_author.description
|
|
|
|
|
assert author_attrs.avatar_url == saved_author.avatar_url
|
|
|
|
|
assert author = saved_author
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|