Skip to content

Commit eeebcd9

Browse files
test: accepts top level meta in atomic ADD resource request
1 parent 1498a0b commit eeebcd9

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

test/JsonApiDotNetCoreTests/IntegrationTests/Meta/RequestMetaTests.cs

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,48 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
323323
ValidateMetaData(store.Document.Meta);
324324
}
325325

326+
[Fact]
327+
public async Task Accepts_top_level_meta_in_atomic_add_resource_operation()
328+
{
329+
// Arrange
330+
var store = _testContext.Factory.Services.GetRequiredService<RequestDocumentStore>();
331+
332+
SupportTicket existingTicket = _fakers.SupportTicket.GenerateOne();
333+
334+
var requestBody = new
335+
{
336+
atomic__operations = new[]
337+
{
338+
new
339+
{
340+
op = "add",
341+
data = new
342+
{
343+
type = "supportTickets",
344+
attributes = new
345+
{
346+
description = existingTicket.Description
347+
}
348+
}
349+
}
350+
},
351+
meta = GetExampleMetaData()
352+
};
353+
354+
string route = $"/operations";
355+
356+
// Act
357+
(HttpResponseMessage httpResponse, _) = await _testContext.ExecutePostAtomicAsync<Document>(route, requestBody);
358+
359+
// Assert
360+
httpResponse.ShouldHaveStatusCode(HttpStatusCode.OK);
361+
362+
store.Document.Should().NotBeNull();
363+
store.Document.Meta.Should().NotBeNull();
364+
365+
ValidateMetaData(store.Document.Meta);
366+
}
367+
326368
private static Object GetExampleMetaData()
327369
{
328370
return new

0 commit comments

Comments
 (0)