Skip to content

Commit 71f2427

Browse files
committed
Fix packaging test picking the .closure file as the content index
1 parent c2d5ca7 commit 71f2427

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

tests/enduser/Stride.Packaging.Tests/AssetPluginPackagingTests.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System;
55
using System.Collections.Generic;
66
using System.IO;
7+
using System.Linq;
78
using Xunit;
89
using Xunit.Abstractions;
910

@@ -42,7 +43,7 @@ public void ConsumerResolvesPluginTypeWhenAssetAssemblyDeclared()
4243
// Namespacing is on by default: both the plugin's and the consumer's own assets compile
4344
// under their rooted URLs.
4445
var dbDir = Path.Combine(consumerDir, "obj", "stride", "assetbuild", "data", "db");
45-
var index = File.ReadAllText(Directory.GetFiles(dbDir, "index.Consumer.*")[0]);
46+
var index = File.ReadAllText(IndexFile(dbDir));
4647
Assert.Matches(@"(?m)^/StrideAssetPlugin/PluginPage ", index);
4748
Assert.Matches(@"(?m)^/Consumer/Page ", index);
4849

@@ -55,6 +56,10 @@ public void ConsumerResolvesPluginTypeWhenAssetAssemblyDeclared()
5556
AssertRuntimeContentResolves(consumerDir);
5657
}
5758

59+
/// <summary>The content index in the db dir (the glob also matches its .closure sibling).</summary>
60+
private static string IndexFile(string dbDir) =>
61+
Directory.GetFiles(dbDir, "index.Consumer.*").Single(f => !f.EndsWith(".closure"));
62+
5863
/// <summary>Run the built consumer: it loads content by rooted and bare (aliased) URLs.</summary>
5964
private void AssertRuntimeContentResolves(string consumerDir)
6065
{
@@ -88,7 +93,7 @@ public void PluginUrlsIdenticalViaProjectReference()
8893
Assert.DoesNotContain(UnresolvedSpinScript, result.Output);
8994

9095
var dbDir = Path.Combine(consumerDir, "obj", "stride", "assetbuild", "data", "db");
91-
var index = File.ReadAllText(Directory.GetFiles(dbDir, "index.Consumer.*")[0]);
96+
var index = File.ReadAllText(IndexFile(dbDir));
9297
Assert.Matches(@"(?m)^/StrideAssetPlugin/PluginPage ", index);
9398
Assert.Matches(@"(?m)^/Consumer/Page ", index);
9499

0 commit comments

Comments
 (0)