Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
Update test after rebase to use new helpers.
  • Loading branch information
martincostello committed May 15, 2024
1 parent ca6e04c commit 561273f
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions test/Swashbuckle.AspNetCore.Cli.Test/ToolTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,23 @@ public static void Can_Generate_Swagger_Json()
Assert.True(productsPath.TryGetProperty("post", out _));
}

[Fact(Skip = "Disabled because it makes CI unstable")]
public void Overwrites_Existing_File()
[Fact(Skip = "https://github.com/domaindrivendev/Swashbuckle.AspNetCore/issues/2893")]
public static void Overwrites_Existing_File()
{
using var temporaryDirectory = new TemporaryDirectory();
var path = Path.Combine(temporaryDirectory.Path, "swagger.json");

var dummyContent = new string('x', 100_000);
File.WriteAllText(path, dummyContent);

var args = new string[] { "tofile", "--output", path, Path.Combine(Directory.GetCurrentDirectory(), "Basic.dll"), "v1" };
Assert.Equal(0, Program.Main(args));

var readContent = File.ReadAllText(path);
Assert.True(readContent.Length < dummyContent.Length);
using var document = JsonDocument.Parse(readContent);
using var document = RunApplication((outputPath) =>
{
File.WriteAllText(outputPath, new string('x', 100_000));

return
[
"tofile",
"--output",
outputPath,
"--serializeasv2",
Path.Combine(Directory.GetCurrentDirectory(), "Basic.dll"),
"v1"
];
});

// verify one of the endpoints
var paths = document.RootElement.GetProperty("paths");
Expand Down

0 comments on commit 561273f

Please sign in to comment.