Skip to content

Commit

Permalink
test(new iot): update tests to validate new implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
Pedro Silva authored and Pedro Silva committed Jan 24, 2025
1 parent 2157228 commit 98f2fa4
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions tests/Specs/New.cs
Original file line number Diff line number Diff line change
Expand Up @@ -308,10 +308,11 @@ public void Help_FailNoPackage(string mesVersion, bool shouldDisplayError)

[Theory]
[InlineData("9.0.0")]
[InlineData("10.0.0"), Trait("TestCategory", "LongRunning"), Trait("TestCategory", "Internal")]
[InlineData("10.0.0", true, true), Trait("TestCategory", "LongRunning"), Trait("TestCategory", "Internal")]
[InlineData("10.2.0", false), Trait("TestCategory", "LongRunning"), Trait("TestCategory", "Internal")]
public void IoT(string mesVersion, bool htmlPackageLocationFullPath = false, bool isAngularPackage = false)
[InlineData("10.2.5", true), Trait("TestCategory", "LongRunning"), Trait("TestCategory", "Internal")]
[InlineData("10.2.5", true, true), Trait("TestCategory", "LongRunning"), Trait("TestCategory", "Internal")]
[InlineData("10.2.7", true, true), Trait("TestCategory", "LongRunning"), Trait("TestCategory", "Internal")]
[InlineData("10.2.7"), Trait("TestCategory", "LongRunning"), Trait("TestCategory", "Internal")]
public void IoT(string mesVersion, bool htmlPackageLocationFullPath = false, bool isAngularPackageFlag = false)
{
string dir = TestUtilities.GetTmpDirectory();
string packageId = "Cmf.Custom.IoT";
Expand All @@ -322,6 +323,9 @@ public void IoT(string mesVersion, bool htmlPackageLocationFullPath = false, boo
string packageIdData = "Cmf.Custom.IoT.Data";
string packageFolderData = mesVersion == "9.0.0" ? "IoTData" : packageIdData;

// Before v10.2.7, all packages were Angular packages, even if the flag was not passed explicitly
bool isAngularPackage = isAngularPackageFlag || Version.Parse(mesVersion) < new Version(10, 2, 7);

CopyNewFixture(dir, mesVersion: mesVersion);
if (mesVersion == "9.0.0")
{
Expand All @@ -331,10 +335,17 @@ public void IoT(string mesVersion, bool htmlPackageLocationFullPath = false, boo
{
var htmlPackageName = "Cmf.Custom.HTML";
var targetDir = new DirectoryInfo(dir);

TestUtilities.CopyFixturePackage(htmlPackageName, targetDir);
string htmlPackageLocation = htmlPackageLocationFullPath ? htmlPackageName : Path.Join(targetDir.FullName, htmlPackageName);
RunNew(new IoTCommand(), packageId, mesVersion: mesVersion, scaffoldingDir: dir, extraArguments: new string[] { "--htmlPackageLocation", htmlPackageLocation, "--isAngularPackage", "true" });

var extraArguments = new List<string> { "--htmlPackageLocation", htmlPackageLocation };
if (isAngularPackageFlag)
{
extraArguments.Add("--isAngularPackage");
}

RunNew(new IoTCommand(), packageId, mesVersion: mesVersion, scaffoldingDir: dir, extraArguments: extraArguments.ToArray());
}
else
{
Expand Down Expand Up @@ -370,6 +381,8 @@ public void IoT(string mesVersion, bool htmlPackageLocationFullPath = false, boo
relatedPackages.GetProperty("postBuild").GetBoolean().Should().BeTrue();
relatedPackages.GetProperty("prePack").GetBoolean().Should().BeFalse();
relatedPackages.GetProperty("postPack").GetBoolean().Should().BeTrue();

File.Exists($"{packageId}/{packageFolderPackages}/angular.json").Should().BeTrue();
}
else
{
Expand Down

0 comments on commit 98f2fa4

Please sign in to comment.