mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 17:11:10 +00:00
Formats code comments as sentences in the tests.
Capitalizes the first word and adds the terminal period in the unit, integration and security tests. The AAA markers stay bare, the TODO bodies stay lowercase, and no assertion, payload, expected status code or test signature changes.
This commit is contained in:
1 parent
727aa33318
commit
057f557791
540 files changed
+3888
-3888
No files matched your search
+6
-6
@@ -72,12 +72,12 @@ public class DeleteThemeEndpointTests : IClassFixture<AuthenticatedLuminaApiFact
|
||||
// Assert
|
||||
Assert.Equal(HttpStatusCode.NoContent, response.StatusCode);
|
||||
|
||||
// the theme row is removed from the database
|
||||
// The theme row is removed from the database.
|
||||
using IServiceScope scope = _apiFactory.Services.CreateScope();
|
||||
LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService<LuminaDbContext>();
|
||||
Assert.Null(await dbContext.Themes.FirstOrDefaultAsync(theme => theme.ThemeId == themeId));
|
||||
|
||||
// the theme no longer appears in GET /themes
|
||||
// The theme no longer appears in GET /themes.
|
||||
HttpResponseMessage listResponse = await _client.GetAsync("/api/v1/themes");
|
||||
List<ThemeResponse>? themes = await listResponse.Content.ReadFromJsonAsync<List<ThemeResponse>>(_jsonOptions);
|
||||
Assert.NotNull(themes);
|
||||
@@ -114,11 +114,11 @@ public class DeleteThemeEndpointTests : IClassFixture<AuthenticatedLuminaApiFact
|
||||
// Arrange
|
||||
await ThemeTestHelpers.WaitForBundledThemeAsync(_apiFactory);
|
||||
|
||||
// deleting a bundled theme that is not the last remaining one is allowed, so only the last one is protected
|
||||
// Deleting a bundled theme that is not the last remaining one is allowed, so only the last one is protected.
|
||||
HttpResponseMessage firstDeletionResponse = await _client.DeleteAsync("/api/v1/themes/editorial-paper");
|
||||
Assert.Equal(HttpStatusCode.NoContent, firstDeletionResponse.StatusCode);
|
||||
|
||||
// Act: the last remaining bundled theme cannot be deleted
|
||||
// Act: the last remaining bundled theme cannot be deleted.
|
||||
HttpResponseMessage response = await _client.DeleteAsync("/api/v1/themes/lumina-default");
|
||||
|
||||
// Assert
|
||||
@@ -135,7 +135,7 @@ public class DeleteThemeEndpointTests : IClassFixture<AuthenticatedLuminaApiFact
|
||||
Assert.NotNull(problemDetails["traceId"].GetString());
|
||||
Assert.NotEmpty(problemDetails["traceId"].GetString()!);
|
||||
|
||||
// restore the soft-deleted bundled theme, so the following tests start from a clean state
|
||||
// Restore the soft-deleted bundled theme, so the following tests start from a clean state.
|
||||
HttpResponseMessage restoreResponse = await _client.PostAsJsonAsync("/api/v1/themes/editorial-paper/restore", new { });
|
||||
Assert.Equal(HttpStatusCode.NoContent, restoreResponse.StatusCode);
|
||||
}
|
||||
@@ -218,7 +218,7 @@ public class DeleteThemeEndpointTests : IClassFixture<AuthenticatedLuminaApiFact
|
||||
foreach (string themeId in _installedThemeIds)
|
||||
await themeService.DeleteAsync(themeId, CancellationToken.None);
|
||||
|
||||
// the admin seeding performed by the factory is not idempotent, so the seed data must be cleared between tests
|
||||
// The admin seeding performed by the factory is not idempotent, so the seed data must be cleared between tests.
|
||||
await dbContext.Set<RolePermissionEntity>().ExecuteDeleteAsync();
|
||||
await dbContext.Set<UserPermissionEntity>().ExecuteDeleteAsync();
|
||||
await dbContext.Set<UserRoleEntity>().ExecuteDeleteAsync();
|
||||
|
||||
+4
-4
@@ -86,13 +86,13 @@ public class InstallThemeEndpointTests : IClassFixture<AuthenticatedLuminaApiFac
|
||||
Assert.Equal(ThemeInstallSource.Uploaded, result.InstallSource);
|
||||
Assert.Null(result.IsCurrent);
|
||||
|
||||
// the installed theme is listed by GET /themes
|
||||
// The installed theme is listed by GET /themes.
|
||||
HttpResponseMessage listResponse = await _client.GetAsync("/api/v1/themes");
|
||||
List<ThemeResponse>? themes = await listResponse.Content.ReadFromJsonAsync<List<ThemeResponse>>(_jsonOptions);
|
||||
Assert.NotNull(themes);
|
||||
Assert.Contains(themes!, theme => theme.ThemeId == themeId);
|
||||
|
||||
// the installed theme is persisted in the database
|
||||
// The installed theme is persisted in the database.
|
||||
using IServiceScope scope = _apiFactory.Services.CreateScope();
|
||||
LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService<LuminaDbContext>();
|
||||
Assert.NotNull(await dbContext.Themes.FirstOrDefaultAsync(theme => theme.ThemeId == themeId));
|
||||
@@ -131,7 +131,7 @@ public class InstallThemeEndpointTests : IClassFixture<AuthenticatedLuminaApiFac
|
||||
public async Task InstallTheme_WhenCalledWithoutArchive_ShouldReturnValidationProblem()
|
||||
{
|
||||
// Arrange
|
||||
// a multipart form without any file part, only a regular form field, so the archive is missing
|
||||
// A multipart form without any file part, only a regular form field, so the archive is missing.
|
||||
using MultipartFormDataContent multipartContent = [];
|
||||
multipartContent.Add(new StringContent("value"), "field");
|
||||
|
||||
@@ -224,7 +224,7 @@ public class InstallThemeEndpointTests : IClassFixture<AuthenticatedLuminaApiFac
|
||||
foreach (string themeId in _installedThemeIds)
|
||||
await themeService.DeleteAsync(themeId, CancellationToken.None);
|
||||
|
||||
// the admin seeding performed by the factory is not idempotent, so the seed data must be cleared between tests
|
||||
// The admin seeding performed by the factory is not idempotent, so the seed data must be cleared between tests.
|
||||
await dbContext.Set<RolePermissionEntity>().ExecuteDeleteAsync();
|
||||
await dbContext.Set<UserPermissionEntity>().ExecuteDeleteAsync();
|
||||
await dbContext.Set<UserRoleEntity>().ExecuteDeleteAsync();
|
||||
|
||||
+2
-2
@@ -79,7 +79,7 @@ public class RestoreThemeEndpointTests : IClassFixture<AuthenticatedLuminaApiFac
|
||||
// Assert
|
||||
Assert.Equal(HttpStatusCode.NoContent, response.StatusCode);
|
||||
|
||||
// the theme is available again and appears in the list
|
||||
// The theme is available again and appears in the list.
|
||||
using IServiceScope verificationScope = _apiFactory.Services.CreateScope();
|
||||
LuminaDbContext verificationContext = verificationScope.ServiceProvider.GetRequiredService<LuminaDbContext>();
|
||||
ThemeEntity? restoredTheme = await verificationContext.Themes.FirstOrDefaultAsync(candidate => candidate.ThemeId == "editorial-paper");
|
||||
@@ -218,7 +218,7 @@ public class RestoreThemeEndpointTests : IClassFixture<AuthenticatedLuminaApiFac
|
||||
foreach (string themeId in _installedThemeIds)
|
||||
await themeService.DeleteAsync(themeId, CancellationToken.None);
|
||||
|
||||
// the admin seeding performed by the factory is not idempotent, so the seed data must be cleared between tests
|
||||
// The admin seeding performed by the factory is not idempotent, so the seed data must be cleared between tests.
|
||||
await dbContext.Set<RolePermissionEntity>().ExecuteDeleteAsync();
|
||||
await dbContext.Set<UserPermissionEntity>().ExecuteDeleteAsync();
|
||||
await dbContext.Set<UserRoleEntity>().ExecuteDeleteAsync();
|
||||
|
||||
+3
-3
@@ -82,7 +82,7 @@ public class SetCurrentThemeEndpointTests : IClassFixture<AuthenticatedLuminaApi
|
||||
Assert.Equal(themeId, result!.ThemeId);
|
||||
Assert.True(result.IsCurrent);
|
||||
|
||||
// the newly active theme is returned by GET /themes/current
|
||||
// The newly active theme is returned by GET /themes/current.
|
||||
HttpResponseMessage currentResponse = await _client.GetAsync("/api/v1/themes/current");
|
||||
ThemeResponse? current = await currentResponse.Content.ReadFromJsonAsync<ThemeResponse>(_jsonOptions);
|
||||
Assert.NotNull(current);
|
||||
@@ -222,7 +222,7 @@ public class SetCurrentThemeEndpointTests : IClassFixture<AuthenticatedLuminaApi
|
||||
}
|
||||
}
|
||||
|
||||
// restore the bundled default theme as the active one, so the following tests start from a clean state
|
||||
// Restore the bundled default theme as the active one, so the following tests start from a clean state.
|
||||
ThemeEntity? bundledTheme = await dbContext.Themes.FirstOrDefaultAsync(t => t.ThemeId == "lumina-default");
|
||||
if (bundledTheme is not null)
|
||||
bundledTheme.IsCurrent = true;
|
||||
@@ -233,7 +233,7 @@ public class SetCurrentThemeEndpointTests : IClassFixture<AuthenticatedLuminaApi
|
||||
foreach (string themeId in _installedThemeIds)
|
||||
await themeService.DeleteAsync(themeId, CancellationToken.None);
|
||||
|
||||
// the admin seeding performed by the factory is not idempotent, so the seed data must be cleared between tests
|
||||
// The admin seeding performed by the factory is not idempotent, so the seed data must be cleared between tests.
|
||||
await dbContext.Set<RolePermissionEntity>().ExecuteDeleteAsync();
|
||||
await dbContext.Set<UserPermissionEntity>().ExecuteDeleteAsync();
|
||||
await dbContext.Set<UserRoleEntity>().ExecuteDeleteAsync();
|
||||
|
||||
+1
-1
@@ -52,7 +52,7 @@ public class GetThemeAssetEndpointTests : IClassFixture<AuthenticatedLuminaApiFa
|
||||
HttpClient anonymousClient = _apiFactory.CreateClient();
|
||||
|
||||
// Act
|
||||
// the asset path is relative to the theme pack root and includes the assets/ prefix, so the URL is
|
||||
// The asset path is relative to the theme pack root and includes the assets/ prefix, so the URL is
|
||||
// /themes/{themeId}/assets/assets/{assetPath} (the first assets/ segment is the route prefix)
|
||||
HttpResponseMessage response = await anonymousClient.GetAsync("/api/v1/themes/editorial-paper/assets/assets/theme.css");
|
||||
|
||||
|
||||
Reference in new issue
Block a user