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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<IsPackable>false</IsPackable>
|
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||
<EnforceCodeStyleInBuild>false</EnforceCodeStyleInBuild>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" />
|
||||
<PackageReference Include="xunit" />
|
||||
<PackageReference Include="xunit.runner.visualstudio">
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\TeleWave.Domain\TeleWave.Domain.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
Reference in New Issue
Block a user