1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-04 01:22:50 -05:00

Unit Tests for hot spots (#1454)

* Add TaxInfoTests

* Add UserTests

* Add SendServicTests

* Added IconFetchingServicesTests

* Add endline
This commit is contained in:
Justin Baur
2021-10-28 14:30:41 -04:00
committed by GitHub
parent 7d6f7436a8
commit d854332643
4 changed files with 835 additions and 0 deletions

View File

@ -0,0 +1,43 @@
using Bit.Core.Models.Table;
using Xunit;
namespace Bit.Core.Test.Models.Tables
{
public class UserTests
{
// KB MB GB
public const long Multiplier = 1024 * 1024 * 1024;
[Fact]
public void StorageBytesRemaining_HasMax_DoesNotHaveStorage_ReturnsMaxAsBytes()
{
short maxStorageGb = 1;
var user = new User
{
MaxStorageGb = maxStorageGb,
Storage = null,
};
var bytesRemaining = user.StorageBytesRemaining();
Assert.Equal(bytesRemaining, maxStorageGb * Multiplier);
}
[Theory]
[InlineData(2, 1 * Multiplier, 1 * Multiplier)]
public void StorageBytesRemaining_HasMax_HasStorage_ReturnRemainingStorage(short maxStorageGb, long storageBytes, long expectedRemainingBytes)
{
var user = new User
{
MaxStorageGb = maxStorageGb,
Storage = storageBytes,
};
var bytesRemaining = user.StorageBytesRemaining();
Assert.Equal(expectedRemainingBytes, bytesRemaining);
}
}
}