Skip to content

Commit 0c6328f

Browse files
Add test to check meta in operation level
1 parent 5b44ea4 commit 0c6328f

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

test/JsonApiDotNetCoreTests/IntegrationTests/Meta/OperationsRequestMetaTests.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ public async Task Accepts_meta_in_atomic_remove_resource_operation()
106106
var store = _testContext.Factory.Services.GetRequiredService<RequestDocumentStore>();
107107

108108
Dictionary<string, object?> documentMeta = _fakers.DocumentMeta.GenerateOne();
109+
Dictionary<string, object?> operationMeta = _fakers.ResourceMeta.GenerateOne();
109110

110111
SupportTicket existingTicket = _fakers.SupportTicket.GenerateOne();
111112

@@ -126,7 +127,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
126127
{
127128
type = "supportTickets",
128129
id = existingTicket.StringId
129-
}
130+
},
131+
meta = operationMeta
130132
}
131133
},
132134
meta = documentMeta
@@ -145,6 +147,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
145147
store.Document.Should().NotBeNull();
146148

147149
store.Document.Meta.Should().BeEquivalentToJson(documentMeta);
150+
151+
store.Document.Operations.Should().HaveCount(1);
152+
153+
AtomicOperationObject? operation = store.Document.Operations[0];
154+
operation.Should().NotBeNull();
155+
156+
operation.Meta.Should().BeEquivalentToJson(operationMeta);
148157
}
149158

150159
[Fact]

test/JsonApiDotNetCoreTests/IntegrationTests/Meta/RequestMetaTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
178178
store.Document.Meta.Should().BeEquivalentToJson(documentMeta);
179179

180180
store.Document.Data.SingleValue.Should().NotBeNull();
181+
181182
store.Document.Data.SingleValue.Meta.Should().BeEquivalentToJson(resourceMeta);
182183

183184
store.Document.Data.SingleValue.Relationships.Should().NotBeNull();
@@ -504,7 +505,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
504505
id = existingTicket2.StringId,
505506
meta = identifierMeta2
506507
},
507-
},
508+
}
508509
meta = documentMeta
509510
};
510511

0 commit comments

Comments
 (0)