diff --git a/test/docfx.Tests/DocsetTest.cs b/test/docfx.Tests/DocsetTest.cs index 4e1ca526c6c..26d65708d7b 100644 --- a/test/docfx.Tests/DocsetTest.cs +++ b/test/docfx.Tests/DocsetTest.cs @@ -2,7 +2,7 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System.Runtime.CompilerServices; - +using System.Text.Json; using Microsoft.DocAsCode.Tests.Common; using Xunit; @@ -41,14 +41,14 @@ public static async Task CustomLogo_Override_LogoFromTemplate() { ["docfx.json"] = """ - { - "build": { - "resource": [{ "files": [ "logo.svg" ] }], - "template": ["default"], - "dest": "_site" - } + { + "build": { + "resource": [{ "files": [ "logo.svg" ] }], + "template": ["default"], + "dest": "_site" } - """, + } + """, ["logo.svg"] = "my svg" }); @@ -62,18 +62,46 @@ public static async Task Load_Custom_Plugin_From_Template() { ["docfx.json"] = """ - { - "build": { - "content": [{ "files": [ "*.md" ] }], - "template": ["default", "../../Assets/template"], - "dest": "_site", - "postProcessors": ["CustomPostProcessor"] - } + { + "build": { + "content": [{ "files": [ "*.md" ] }], + "template": ["default", "../../Assets/template"], + "dest": "_site", + "postProcessors": ["CustomPostProcessor"] } - """, + } + """, ["index.md"] = "" }); Assert.Equal("customPostProcessor", outputs["customPostProcessor.txt"]()); } + + [Fact] + public static async Task Build_With_Global_Metadata_Files() + { + var outputs = await Build(new() + { + ["docfx.json"] = + """ + { + "build": { + "content": [{ "files": [ "*.md" ] }], + "dest": "_site", + "exportRawModel": true, + "globalMetadataFiles": "projectMetadata.json" + } + } + """, + ["projectMetadata.json"] = + """ + { + "_appTitle": "Something Really Stupid", + } + """, + ["index.md"] = "" + }); + + Assert.Equal("Something Really Stupid", JsonDocument.Parse(outputs["index.raw.json"]()).RootElement.GetProperty("_appTitle").GetString()); + } }