Skip to content

Commit

Permalink
fix update page with raw_schema field
Browse files Browse the repository at this point in the history
  • Loading branch information
leandrocp committed Nov 9, 2023
1 parent e1ebb56 commit 4fa1eca
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/beacon/content/page.ex
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ defmodule Beacon.Content.Page do
:title,
:description,
:meta_tags,
:raw_schema,
:format
])
|> cast(attrs, [:path], empty_values: [])
Expand Down
15 changes: 15 additions & 0 deletions test/beacon/content_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,21 @@ defmodule Beacon.ContentTest do
})
end

test "update raw_schema" do
layout = layout_fixture(site: :raw_schema_test)

page =
Content.create_page!(%{
site: "my_site",
path: "/",
template: "<p>page</p>",
layout_id: layout.id,
raw_schema: [%{"foo" => "bar"}]
})

assert {:ok, %Page{raw_schema: [%{"@type" => "BlogPosting"}]}} = Content.update_page(page, %{"raw_schema" => [%{"@type" => "BlogPosting"}]})
end

test "validate raw_schema" do
layout = layout_fixture(site: :raw_schema_test)

Expand Down

0 comments on commit 4fa1eca

Please sign in to comment.