Update Book and Publisher transformers to sync the relationship for DBIServer.
This commit is contained in:
@@ -8,6 +8,7 @@ defmodule DecentralisedBookIndex.Sync.DataTransformers.BookTransformerTest do
|
||||
json_body = %{
|
||||
"data" => %{
|
||||
"attributes" => %{
|
||||
"dbi_server_id" => "889a323e-d104-4b5d-b276-dad5a9b1da99",
|
||||
"cover_image_url" => "/images/book_cover.png",
|
||||
"description" => "A cool book.",
|
||||
"format" => "Paper",
|
||||
@@ -37,6 +38,8 @@ defmodule DecentralisedBookIndex.Sync.DataTransformers.BookTransformerTest do
|
||||
},
|
||||
"meta" => %{}
|
||||
},
|
||||
"book_editions_registry" => %{"links" => %{}, "meta" => %{}},
|
||||
"dbi_server" => %{"links" => %{}, "meta" => %{}},
|
||||
"publisher" => %{
|
||||
"links" => %{
|
||||
"related" =>
|
||||
@@ -67,13 +70,15 @@ defmodule DecentralisedBookIndex.Sync.DataTransformers.BookTransformerTest do
|
||||
published: "2025-03-05",
|
||||
publisher_id: "11349865-1b7b-454a-b999-6c4059888a78",
|
||||
title: "Book",
|
||||
updated_at: "2025-04-01T18:14:25.754055Z"
|
||||
updated_at: "2025-04-01T18:14:25.754055Z",
|
||||
dbi_server_id: "889a323e-d104-4b5d-b276-dad5a9b1da99"
|
||||
} = book
|
||||
end
|
||||
|
||||
test "a json doesn't contains book information \"data\" attribute" do
|
||||
json_body = %{
|
||||
"attributes" => %{
|
||||
"dbi_server_id" => "889a323e-d104-4b5d-b276-dad5a9b1da99",
|
||||
"cover_image_url" => "/images/book_cover.png",
|
||||
"description" => "A cool book.",
|
||||
"format" => "Paper",
|
||||
@@ -103,6 +108,8 @@ defmodule DecentralisedBookIndex.Sync.DataTransformers.BookTransformerTest do
|
||||
},
|
||||
"meta" => %{}
|
||||
},
|
||||
"book_editions_registry" => %{"links" => %{}, "meta" => %{}},
|
||||
"dbi_server" => %{"links" => %{}, "meta" => %{}},
|
||||
"publisher" => %{
|
||||
"links" => %{
|
||||
"related" =>
|
||||
@@ -127,7 +134,8 @@ defmodule DecentralisedBookIndex.Sync.DataTransformers.BookTransformerTest do
|
||||
published: "2025-03-05",
|
||||
publisher_id: "11349865-1b7b-454a-b999-6c4059888a78",
|
||||
title: "Book",
|
||||
updated_at: "2025-04-01T18:14:25.754055Z"
|
||||
updated_at: "2025-04-01T18:14:25.754055Z",
|
||||
dbi_server_id: "889a323e-d104-4b5d-b276-dad5a9b1da99"
|
||||
} = book
|
||||
end
|
||||
end
|
||||
|
||||
@@ -8,6 +8,7 @@ defmodule DecentralisedBookIndex.Sync.DataTransformers.PublisherTransformerTest
|
||||
json_body = %{
|
||||
"data" => %{
|
||||
"attributes" => %{
|
||||
"dbi_server_id" => "889a323e-d104-4b5d-b276-dad5a9b1da99",
|
||||
"inserted_at" => "2025-03-21T09:20:48.791539Z",
|
||||
"name" => "Publisher",
|
||||
"updated_at" => "2025-03-21T09:20:48.791539Z"
|
||||
@@ -15,7 +16,7 @@ defmodule DecentralisedBookIndex.Sync.DataTransformers.PublisherTransformerTest
|
||||
"id" => "11349865-1b7b-454a-b999-6c4059888a78",
|
||||
"links" => %{},
|
||||
"meta" => %{},
|
||||
"relationships" => %{},
|
||||
"relationships" => %{"dbi_server" => %{"links" => %{}, "meta" => %{}}},
|
||||
"type" => "publisher"
|
||||
},
|
||||
"jsonapi" => %{"version" => "1.0"},
|
||||
@@ -32,13 +33,15 @@ defmodule DecentralisedBookIndex.Sync.DataTransformers.PublisherTransformerTest
|
||||
id: "11349865-1b7b-454a-b999-6c4059888a78",
|
||||
name: "Publisher",
|
||||
inserted_at: "2025-03-21T09:20:48.791539Z",
|
||||
updated_at: "2025-03-21T09:20:48.791539Z"
|
||||
updated_at: "2025-03-21T09:20:48.791539Z",
|
||||
dbi_server_id: "889a323e-d104-4b5d-b276-dad5a9b1da99"
|
||||
} = publisher
|
||||
end
|
||||
|
||||
test "a json doesn't contains publisher information \"data\" attribute" do
|
||||
json_body = %{
|
||||
"attributes" => %{
|
||||
"dbi_server_id" => "889a323e-d104-4b5d-b276-dad5a9b1da99",
|
||||
"inserted_at" => "2025-03-21T09:20:48.791539Z",
|
||||
"name" => "Publisher",
|
||||
"updated_at" => "2025-03-21T09:20:48.791539Z"
|
||||
@@ -46,7 +49,7 @@ defmodule DecentralisedBookIndex.Sync.DataTransformers.PublisherTransformerTest
|
||||
"id" => "11349865-1b7b-454a-b999-6c4059888a78",
|
||||
"links" => %{},
|
||||
"meta" => %{},
|
||||
"relationships" => %{},
|
||||
"relationships" => %{"dbi_server" => %{"links" => %{}, "meta" => %{}}},
|
||||
"type" => "publisher"
|
||||
}
|
||||
|
||||
@@ -56,7 +59,8 @@ defmodule DecentralisedBookIndex.Sync.DataTransformers.PublisherTransformerTest
|
||||
id: "11349865-1b7b-454a-b999-6c4059888a78",
|
||||
name: "Publisher",
|
||||
inserted_at: "2025-03-21T09:20:48.791539Z",
|
||||
updated_at: "2025-03-21T09:20:48.791539Z"
|
||||
updated_at: "2025-03-21T09:20:48.791539Z",
|
||||
dbi_server_id: "889a323e-d104-4b5d-b276-dad5a9b1da99"
|
||||
} = publisher
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user