Skip to content

Commit

Permalink
Merge branch 'release/0.15.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalberger committed Sep 12, 2018
2 parents 1f8781e + 28a7b2b commit af6b029
Show file tree
Hide file tree
Showing 22 changed files with 816 additions and 76 deletions.
1 change: 0 additions & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,4 @@ branches:
# Build Cache #
#---------------------------------#
cache:
- src\packages -> src\**\packages.config
- tools -> setup.cake
6 changes: 3 additions & 3 deletions src/Cake.Npm.Tests/Cake.Npm.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
<ItemGroup>
<PackageReference Include="Cake.Core" Version="0.28.0" />
<PackageReference Include="Cake.Testing" Version="0.28.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" />
<PackageReference Include="Shouldly" Version="3.0.0" />
<PackageReference Include="xunit" Version="2.3.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
<PackageReference Include="xunit" Version="2.4.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
</ItemGroup>

<ItemGroup>
Expand Down
83 changes: 83 additions & 0 deletions src/Cake.Npm.Tests/Ci/NpmCiSettingsExtensionsTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
namespace Cake.Npm.Tests.Ci
{
using Cake.Npm.Ci;
using Shouldly;
using System;
using Xunit;

public sealed class NpmUpdateSettingsExtensionsTests
{
public sealed class TheForProductionMethod
{
[Fact]
public void Should_Throw_If_Settings_Are_Null()
{
// Given
NpmCiSettings settings = null;

// When
var result = Record.Exception(() => settings.ForProduction());

// Then
result.IsArgumentNullException("settings");
}
[Fact]
public void Should_Set_Production()
{
// Given
var settings = new NpmCiSettings();

// When
settings.ForProduction();

// Then
settings.Production.ShouldBe(true);
}
}

public sealed class TheFromRegistryMethod
{
[Fact]
public void Should_Throw_If_Settings_Are_Null()
{
// Given
NpmCiSettings settings = null;
var registry = new Uri("https://myregistry.com");

// When
var result = Record.Exception(() => settings.FromRegistry(registry));

// Then
result.IsArgumentNullException("settings");
}

[Fact]
public void Should_Throw_If_Registry_Is_Null()
{
// Given
var settings = new NpmCiSettings();
Uri registry = null;

// When
var result = Record.Exception(() => settings.FromRegistry(registry));

// Then
result.IsArgumentNullException("registry");
}

[Fact]
public void Should_Set_Registry()
{
// Given
var settings = new NpmCiSettings();
var registry = new Uri("https://myregistry.com");

// When
var result = settings.FromRegistry(registry);

// Then
result.Registry.ShouldBe(registry);
}
}
}
}
16 changes: 15 additions & 1 deletion src/Cake.Npm.Tests/Ci/NpmCiToolTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,20 @@ public void Should_Include_Production_Flag()
Assert.Equal("ci --production", result.Args);
}

}

[Fact]
public void Should_Include_Registry_Args_If_Set()
{
// Given
var fixture = new NpmCiToolFixture();
fixture.Settings.FromRegistry(new Uri("https://myregistry/"));

// When
var result = fixture.Run();

// Then
Assert.Equal("ci --registry https://myregistry/", result.Args);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using Shouldly;
using Xunit;

public sealed class NpmInstallSettingsExtensionsTests
public sealed class NpmRebuildSettingsExtensionsTests
{
public sealed class TheWithForceMethod
{
Expand Down Expand Up @@ -785,5 +785,50 @@ public void Should_Quote_If_Tag_Contains_WhiteSpace()
settings.Packages.ShouldContain(scope + "/" + packageName + "@\"" + tag + "\"");
}
}

public sealed class TheFromRegistryMethod
{
[Fact]
public void Should_Throw_If_Settings_Are_Null()
{
// Given
NpmInstallSettings settings = null;
Uri registry = new Uri("https://myregistry.com");

// When
var result = Record.Exception(() => settings.FromRegistry(registry));

// Then
result.IsArgumentNullException("settings");
}

[Fact]
public void Should_Throw_If_Registry_Is_Null()
{
// Given
var settings = new NpmInstallSettings();
Uri registry = null;

// When
var result = Record.Exception(() => settings.FromRegistry(registry));

// Then
result.IsArgumentNullException("registry");
}

[Fact]
public void Should_Set_Registry()
{
// Given
var settings = new NpmInstallSettings();
Uri registry = new Uri("https://myregistry.com");

// When
var result = settings.FromRegistry(registry);

// Then
result.Registry.ShouldBe(registry);
}
}
}
}
8 changes: 4 additions & 4 deletions src/Cake.Npm.Tests/Install/NpmInstallerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -218,11 +218,11 @@ public void Should_Add_PreferOffline_To_Arguments_If_Not_Null()
}

[Fact]
public void Should_Add_Registry_To_Arguments_If_Not_Empty()
public void Should_Add_Registry_To_Arguments_If_Set()
{
// Given
var fixture = new NpmInstallerFixture();
var registry = "http://exampleregistry.com";
var registry = new Uri("http://exampleregistry.com");
fixture.Settings.Registry = registry;

// When
Expand All @@ -233,11 +233,11 @@ public void Should_Add_Registry_To_Arguments_If_Not_Empty()
}

[Fact]
public void Should_Not_Add_Registry_To_Arguments_If_Empty()
public void Should_Not_Add_Registry_To_Arguments_If_Not_Set()
{
// Given
var fixture = new NpmInstallerFixture();
fixture.Settings.Registry = "";
fixture.Settings.Registry = null;

// When
var result = fixture.Run();
Expand Down
Loading

0 comments on commit af6b029

Please sign in to comment.