diff --git a/spec/jekyll_seo_tag/json_ld_spec.rb b/spec/jekyll_seo_tag/json_ld_drop_spec.rb similarity index 96% rename from spec/jekyll_seo_tag/json_ld_spec.rb rename to spec/jekyll_seo_tag/json_ld_drop_spec.rb index df463d5..ea6a601 100644 --- a/spec/jekyll_seo_tag/json_ld_spec.rb +++ b/spec/jekyll_seo_tag/json_ld_drop_spec.rb @@ -152,4 +152,12 @@ RSpec.describe Jekyll::SeoTag::JSONLDDrop do expect(subject).to have_key("url") expect(subject["url"]).to eql("/page.html") end + + context "with null values" do + let(:metadata) { {} } + + it "does not return null values as json" do + expect(subject.to_json).to_not match(/:null/) + end + end end diff --git a/spec/jekyll_seo_tag_integration_spec.rb b/spec/jekyll_seo_tag_integration_spec.rb index 8f4f589..9a13ac7 100755 --- a/spec/jekyll_seo_tag_integration_spec.rb +++ b/spec/jekyll_seo_tag_integration_spec.rb @@ -338,6 +338,10 @@ EOS it "minifies JSON-LD" do expect(output).to_not match(%r!{.*?\s.*?}!) end + + it "removes null values from JSON-LD" do + expect(output).to_not match(/:null/) + end end end