Initial commit: base slice (auth, roles, users, admin) scaffold
Backend: .NET 10 Clean Architecture + LiteCqrs.Net + EF Core/PostgreSQL + Identity/JWT. Frontend: React 19 + Vite + TanStack Query/Router + Tailwind v4 with a retro CRT theme. Docker/compose deployment mirroring PnvPanel's conventions, scoped down to the current base feature set.
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
using TeleWave.Domain.Auth;
|
||||
using Xunit;
|
||||
|
||||
namespace TeleWave.Domain.Tests.Auth;
|
||||
|
||||
public class RefreshTokenTests
|
||||
{
|
||||
[Fact]
|
||||
public void Issue_CreatesActiveToken()
|
||||
{
|
||||
var token = RefreshToken.Issue(Guid.NewGuid(), "hash", DateTimeOffset.UtcNow.AddDays(1));
|
||||
|
||||
Assert.True(token.IsActive);
|
||||
Assert.Null(token.RevokedAt);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void IsActive_WhenExpired_ReturnsFalse()
|
||||
{
|
||||
var token = RefreshToken.Issue(Guid.NewGuid(), "hash", DateTimeOffset.UtcNow.AddDays(-1));
|
||||
|
||||
Assert.False(token.IsActive);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Revoke_MarksTokenInactive()
|
||||
{
|
||||
var token = RefreshToken.Issue(Guid.NewGuid(), "hash", DateTimeOffset.UtcNow.AddDays(1));
|
||||
|
||||
token.Revoke("new-hash");
|
||||
|
||||
Assert.False(token.IsActive);
|
||||
Assert.NotNull(token.RevokedAt);
|
||||
Assert.Equal("new-hash", token.ReplacedByTokenHash);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user