Skip to content

Commit

Permalink
Test for not found packages
Browse files Browse the repository at this point in the history
  • Loading branch information
0xced committed Mar 12, 2024
1 parent db7e3a2 commit 586127a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/Chisel.Tests/DependencyGraphTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ public async Task MongoDbGraph(bool writeIgnoredPackages)
];
var assetsFile = GetAssetsPath("MongoDbGraph.json");
var graph = new DependencyGraph(resolvedPackages, assetsFile, tfm: "net8.0", rid: "", ignores: [ "Testcontainers.MongoDb" ]);
var (removed, notFound, removedRoots) = graph.Remove([ "MongoDB.Driver", "AWSSDK.SecurityToken" ]);
var (removed, notFound, removedRoots) = graph.Remove([ "MongoDB.Driver", "AWSSDK.SecurityToken", "NonExistentPackage" ]);
await using var writer = new StringWriter();
GraphWriter.Graphviz(writer).Write(graph, GraphDirection.LeftToRight, writeIgnoredPackages);

removed.Should().BeEquivalentTo("AWSSDK.SecurityToken", "AWSSDK.Core");
notFound.Should().BeEmpty();
notFound.Should().BeEquivalentTo("NonExistentPackage");
removedRoots.Should().BeEquivalentTo("MongoDB.Driver");

await Verify(writer.ToString(), "gv").UseParameters(writeIgnoredPackages);
Expand Down Expand Up @@ -96,7 +96,7 @@ public async Task SqlClientGraph(string graphFormat)
];
var assetsFile = GetAssetsPath("SqlClientGraph.json");
var graph = new DependencyGraph(resolvedPackages, assetsFile, tfm: "net8.0-windows", rid: "win-x64", ignores: []);
var (removed, notFound, removedRoots) = graph.Remove([ "Azure.Identity", "Microsoft.IdentityModel.JsonWebTokens", "Microsoft.IdentityModel.Protocols.OpenIdConnect" ]);
var (removed, notFound, removedRoots) = graph.Remove([ "Azure.Identity", "Microsoft.IdentityModel.JsonWebTokens", "Microsoft.IdentityModel.Protocols.OpenIdConnect", "System.Memory.Data" ]);
await using var writer = new StringWriter();

var graphWriter = graphFormat == "graphviz" ? GraphWriter.Graphviz(writer) : GraphWriter.Mermaid(writer);
Expand All @@ -122,7 +122,7 @@ public async Task SqlClientGraph(string graphFormat)
"System.Security.Principal.Windows",
]);
notFound.Should().BeEmpty();
removedRoots.Should().BeEmpty();
removedRoots.Should().BeEquivalentTo(["System.Memory.Data"]);

await Verify(writer.ToString(), graphFormat == "graphviz" ? "gv" : "mmd").UseTextForParameters(graphFormat);
}
Expand Down

0 comments on commit 586127a

Please sign in to comment.