Skip to content

Commit

Permalink
Fix test CheckJSContent
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasDorier committed Apr 1, 2024
1 parent 9ac0e98 commit db73b1f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion BTCPayServer.Tests/ThirdPartyTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -423,9 +423,11 @@ public async Task CanGetRateCryptoCurrenciesByDefault()
[Trait("Fast", "Fast")]
public async Task CheckJsContent()
{
var handler = new HttpClientHandler();
handler.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate | DecompressionMethods.Brotli;
// This test verify that no malicious js is added in the minified files.
// We should extend the tests to other js files, but we can do as we go...
using var client = new HttpClient();
using var client = new HttpClient(handler);
var actual = GetFileContent("BTCPayServer", "wwwroot", "vendor", "bootstrap", "bootstrap.bundle.min.js").Trim();
var version = Regex.Match(actual, "Bootstrap v([0-9]+.[0-9]+.[0-9]+)").Groups[1].Value;
var expected = (await (await client.GetAsync($"https://cdn.jsdelivr.net/npm/bootstrap@{version}/dist/js/bootstrap.bundle.min.js")).Content.ReadAsStringAsync()).Trim();
Expand Down

0 comments on commit db73b1f

Please sign in to comment.