@@ -69,13 +69,19 @@ This is a test page without products frontmatter.
69
69
70
70
// Test that the file has the correct products
71
71
test <@ defaultFile.File.YamlFrontMatter <> null @>
72
- test <@ defaultFile.File.YamlFrontMatter.Products <> null @>
73
- test <@ defaultFile.File.YamlFrontMatter.Products.Count = 2 @>
72
+ match defaultFile.File.YamlFrontMatter with
73
+ | NonNull yamlFrontMatter ->
74
+ test <@ yamlFrontMatter.Products <> null @>
75
+ match yamlFrontMatter.Products with
76
+ | NonNull products ->
77
+ test <@ products.Count = 2 @>
78
+ // Test that the products are correctly identified
79
+ let productIds = products |> Seq.map _. Id |> Set.ofSeq
80
+ test <@ productIds.Contains( " elasticsearch" ) @>
81
+ test <@ productIds.Contains( " ecctl" ) @>
82
+ | _ -> ()
83
+ | _ -> ()
74
84
75
- // Test that the products are correctly identified
76
- let productIds = defaultFile.File.YamlFrontMatter.Products |> Seq.map ( fun p -> p.Id) |> Set.ofSeq
77
- test <@ productIds.Contains( " elasticsearch" ) @>
78
- test <@ productIds.Contains( " ecctl" ) @>
79
85
80
86
[<Fact>]
81
87
let ``does not include products in frontmatter when no products are specified`` () =
@@ -84,4 +90,10 @@ This is a test page without products frontmatter.
84
90
let defaultFile = results.MarkdownResults |> Seq.find ( fun r -> r.File.RelativePath = " index.md" )
85
91
86
92
// Test that the file has no products
87
- test <@ defaultFile.File.YamlFrontMatter = null || defaultFile.File.YamlFrontMatter.Products = null || defaultFile.File.YamlFrontMatter.Products.Count = 0 @>
93
+ match defaultFile.File.YamlFrontMatter with
94
+ | NonNull frontMatter ->
95
+ match frontMatter.Products with
96
+ | NonNull products ->
97
+ test <@ products.Count = 0 @>
98
+ | _ -> ()
99
+ | _ -> ()
0 commit comments