Skip to content

Commit

Permalink
chore: Cleanup tests and fix spellings (#9091)
Browse files Browse the repository at this point in the history
chore: cleanup tests and fix spellings
  • Loading branch information
filzrev authored Aug 17, 2023
1 parent 706a10c commit f698eac
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 71 deletions.
2 changes: 1 addition & 1 deletion src/Docfx.Build.Engine/ManifestProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ private void UpdateContext()

private void NormalizeToObject()
{
Logger.LogVerbose("Normalizing all the object to week type");
Logger.LogVerbose("Normalizing all the object to weak type");

_manifestWithContext.RunAll(m =>
{
Expand Down
2 changes: 1 addition & 1 deletion src/Docfx.Build.SchemaDriven/OverwriteApplier.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public object BuildOverwriteWithSchema(FileModel owModel, OverwriteDocumentModel
transformed["conceptual"] = context.ContentAnchorParser.Content;
}

// add SourceDetail back to transformed, in week type
// add SourceDetail back to transformed, in weak type
if (overwrite.Documentation != null)
{
transformed[Constants.PropertyName.Documentation] = new Dictionary<string, object>
Expand Down
3 changes: 0 additions & 3 deletions test/Docfx.Build.Engine.Tests/XRefMapDownloaderTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ public async Task BaseUrlIsSet()
[Fact]
public async Task ReadLocalXRefMapWithFallback()
{
// GitHub doesn't support TLS 1.1 since Feb 23, 2018. See: https://github.com/blog/2507-weak-cryptographic-standards-removed
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

var basePath = Path.GetRandomFileName();
var fallbackFolders = new List<string>() { Path.Combine(Directory.GetCurrentDirectory(), "TestData") };
var xrefmaps = new List<string>() { "xrefmap.yml" };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ public void ProcessMrefWithRemarksOverwriteShouldSucceed()
}
}

[Fact(Skip = "Markdig does not support multi-uid overwrite")]
[Fact]
public void ProcessMrefWithMultiUidOverwriteShouldSucceed()
{
var files = new FileCollection(_defaultFiles);
Expand All @@ -281,7 +281,7 @@ public void ProcessMrefWithMultiUidOverwriteShouldSucceed()
var model = JsonUtility.Deserialize<ApiBuildOutput>(outputRawModelPath);
Assert.Equal("\n<p sourcefile=\"TestData/overwrite/mref.overwrite.multi.uid.md\" sourcestartlinenumber=\"6\">Overwrite content1</p>\n", model.Conceptual);
Assert.Equal("\n<p sourcefile=\"TestData/overwrite/mref.overwrite.multi.uid.md\" sourcestartlinenumber=\"13\">Overwrite &quot;content2&quot;</p>\n", model.Summary);
Assert.Equal("\n<p sourcefile=\"TestData/overwrite/mref.overwrite.multi.uid.md\" sourcestartlinenumber=\"20\">Overwrite &#39;content3&#39;</p>\n", model.Metadata["not_defined_property"]);
Assert.Equal("\n<p sourcefile=\"TestData/overwrite/mref.overwrite.multi.uid.md\" sourcestartlinenumber=\"20\">Overwrite 'content3'</p>\n", model.Metadata["not_defined_property"]);
}
}

Expand Down
33 changes: 0 additions & 33 deletions test/Docfx.Build.SchemaDriven.Tests/LimitationReachedTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,39 +42,6 @@ public LimitationReachedTest()
_templateManager = new TemplateManager(new List<string> { "template" }, null, _templateFolder);
}

[Fact(Skip = "Manually run this testcase, as it will influence the result of other test cases")]
public void TestSchemaReachedLimits()
{
// Json.NET schema has limitation of 1000 calls per hour
using var listener = new TestListenerScope("TestInvalidMetadataReference");
var schemaFile = CreateFile("template/schemas/limit.test.schema.json", @"
{
""$schema"": ""http://dotnet.github.io/docfx/schemas/v1.0/schema.json#"",
""version"": ""1.0.0"",
""title"": ""LimitTest"",
""description"": ""A simple test schema for sdp"",
""type"": ""object"",
""properties"": {
""metadata"": {
""type"": ""string""
}
}
}
", _templateFolder);

var inputFiles = Enumerable.Range(0, 2000)
.Select(s => CreateFile($"normal{s}.yml", @"### YamlMime:LimitTest
metadata: Web Apps Documentation
", _inputFolder)).ToArray();

FileCollection files = new(_defaultFiles);
files.Add(DocumentType.Article, inputFiles, _inputFolder);
BuildDocument(files);
Assert.Equal(2, listener.Items.Count);
Assert.Single(listener.Items.Where(s => s.Message == "There is no template processing document type(s): LimitTest"));
Assert.True(LimitationReached(listener));
}

private void BuildDocument(FileCollection files)
{
var parameters = new DocumentBuildParameters
Expand Down
17 changes: 9 additions & 8 deletions test/Docfx.MarkdigEngine.Extensions.Tests/CodeSnippetTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,8 @@ static void Main()
}

[Fact]
[Trait("Related", "DfmMarkdown")]
public void TestDfmFencesBlockLevel()
[Trait("Related", "Markdown")]
public void TestFencesBlockLevel()
{
var root = @"
[!code-FakeREST[REST](api.json)]
Expand All @@ -292,7 +292,7 @@ public void TestDfmFencesBlockLevel()
}

[Theory]
[Trait("Related", "DfmMarkdown")]
[Trait("Related", "Markdown")]
#region Inline Data
[InlineData(@"[!code-csharp[Main](Program.cs)]", @"<pre><code class=""lang-csharp"" name=""Main"">namespace ConsoleApplication1
{
Expand Down Expand Up @@ -540,7 +540,7 @@ internal static class Helper
}
</code></pre>")]
#endregion
public void TestDfmFencesBlockLevelWithQueryString(string fencesPath, string expectedContent)
public void TestFencesBlockLevelWithQueryString(string fencesPath, string expectedContent)
{
// arrange
var content = @"namespace ConsoleApplication1
Expand Down Expand Up @@ -581,8 +581,8 @@ public static void Foo()
}

[Fact]
[Trait("Related", "DfmMarkdown")]
public void TestDfmFencesBlockLevelWithWhitespaceLeading()
[Trait("Related", "Markdown")]
public void TestFencesBlockLevelWithWhitespaceLeading()
{
var root = @"
[!code-FakeREST[REST](api.json)]
Expand Down Expand Up @@ -655,8 +655,8 @@ public Greet(string who)
}

[Fact]
[Trait("Related", "DfmMarkdown")]
public void TestDfmFencesBlockLevelWithWorkingFolder()
[Trait("Related", "Markdown")]
public void TestFencesBlockLevelWithWorkingFolder()
{
var root = @"[!code-REST[REST](~/api.json)]";
var apiJsonContent = @"
Expand Down Expand Up @@ -687,6 +687,7 @@ public void TestDfmFencesBlockLevelWithWorkingFolder()
}

[Fact]
[Trait("Related", "Markdown")]
public void CodeSnippetShouldVerifyTagname()
{
//arrange
Expand Down
8 changes: 4 additions & 4 deletions test/Docfx.MarkdigEngine.Extensions.Tests/MathematicsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@ namespace Docfx.MarkdigEngine.Tests;

public class MathematicsTest
{
[Fact(Skip = "Disable math support")]
[Fact]
public void Test_Mathematics_Support_0()
{
var source = "$ math inline $";
var expected = @"<p><span class=""math"">math inline</span></p>";
var expected = """<p><span class="math">\(math inline\)</span></p>""";

TestUtility.VerifyMarkup(source, expected);
}

[Fact(Skip = "Disable math support")]
[Fact]
public void Test_Mathematics_Support_1()
{
var source = "$ math^0 **inline** $";
var expected = @"<p><span class=""math"">math^0 **inline**</span></p>";
var expected = """<p><span class="math">\(math^0 **inline**\)</span></p>""";

TestUtility.VerifyMarkup(source, expected);
}
Expand Down
20 changes: 1 addition & 19 deletions test/docfx.Tests/MetadataCommandTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,24 +43,6 @@ public void TestMetadataCommandFromCSProject()
CheckResult();
}

[Fact]
[Trait("Related", "docfx")]
public void TestMetadataCommandFromCSProjectWithVsinstalldirEnvSet()
{
var envName = "VSINSTALLDIR";
var originalValue = Environment.GetEnvironmentVariable(envName);
Environment.SetEnvironmentVariable(envName, "c:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise");

try
{
TestMetadataCommandFromCSProject();
}
finally
{
Environment.SetEnvironmentVariable(envName, originalValue);
}
}

[Fact]
[Trait("Related", "docfx")]
public void TestMetadataCommandFromDll()
Expand Down Expand Up @@ -261,7 +243,7 @@ public void TestMetadataCommandFromCSProjectWithFilterInOption()
Assert.NotNull(memberViewModel.References.Find(s => s.Uid.Equals("Foo")));
}

[Fact(Skip = "Don't know why this fails.")]
[Fact]
[Trait("Related", "docfx")]
public void TestMetadataCommandFromCSProjectWithDuplicateProjectReference()
{
Expand Down

0 comments on commit f698eac

Please sign in to comment.