fix:
No SOFA trend chart or organ-system timeline No GCS trend chart or component history No qSOFA history view
This commit is contained in:
@@ -2,15 +2,23 @@ using FluentAssertions;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using StackExchange.Redis;
|
||||
using System.Net;
|
||||
using System.Net.Http.Json;
|
||||
using System.Text.Json;
|
||||
|
||||
[Collection("Integration")]
|
||||
public class GcsScoringTests : IAsyncLifetime
|
||||
{
|
||||
private readonly ApiFixture _fixture;
|
||||
private readonly HttpClient _client;
|
||||
private Guid _encounterId;
|
||||
private Guid _patientId;
|
||||
|
||||
public GcsScoringTests(ApiFixture fixture) => _fixture = fixture;
|
||||
public GcsScoringTests(ApiFixture fixture)
|
||||
{
|
||||
_fixture = fixture;
|
||||
_client = fixture.CreateClient();
|
||||
}
|
||||
|
||||
public async Task InitializeAsync()
|
||||
{
|
||||
@@ -194,4 +202,58 @@ public class GcsScoringTests : IAsyncLifetime
|
||||
var score = await db.News2Scores.SingleAsync();
|
||||
score.ConsciousnessScore.Should().Be(0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task GcsHistory_ReturnsPaginatedScores()
|
||||
{
|
||||
using var scope = _fixture.Services.CreateScope();
|
||||
var db = scope.ServiceProvider.GetRequiredService<AppDbContext>();
|
||||
var now = DateTimeOffset.UtcNow;
|
||||
|
||||
db.GcsScores.AddRange(
|
||||
new GcsScore
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
EncounterId = _encounterId,
|
||||
PatientId = _patientId,
|
||||
EyeScore = 4,
|
||||
VerbalScore = 5,
|
||||
MotorScore = 6,
|
||||
TotalScore = 15,
|
||||
Classification = "MILD",
|
||||
CalculatedAt = now.AddHours(-2),
|
||||
CreatedAt = now,
|
||||
},
|
||||
new GcsScore
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
EncounterId = _encounterId,
|
||||
PatientId = _patientId,
|
||||
EyeScore = 2,
|
||||
VerbalScore = 3,
|
||||
MotorScore = 3,
|
||||
TotalScore = 8,
|
||||
Classification = "SEVERE",
|
||||
CalculatedAt = now,
|
||||
CreatedAt = now,
|
||||
});
|
||||
await db.SaveChangesAsync();
|
||||
|
||||
var resp = await _client.GetAsync(
|
||||
$"/api/v1/encounters/{_encounterId}/gcs/history?limit=10");
|
||||
resp.StatusCode.Should().Be(HttpStatusCode.OK);
|
||||
|
||||
var body = await resp.Content.ReadFromJsonAsync<JsonElement>();
|
||||
var items = body.GetProperty("data").GetProperty("items");
|
||||
items.GetArrayLength().Should().Be(2);
|
||||
|
||||
var latest = items[0];
|
||||
latest.GetProperty("totalScore").GetInt32().Should().Be(8);
|
||||
latest.GetProperty("eyeScore").GetInt32().Should().Be(2);
|
||||
latest.GetProperty("verbalScore").GetInt32().Should().Be(3);
|
||||
latest.GetProperty("motorScore").GetInt32().Should().Be(3);
|
||||
|
||||
var earliest = items[1];
|
||||
earliest.GetProperty("totalScore").GetInt32().Should().Be(15);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user