Skip to content

Commit 5ee4d79

Browse files
Add test to check meta in operation level
1 parent b5e99a6 commit 5ee4d79

3 files changed

Lines changed: 12 additions & 3 deletions

File tree

run-docker-postgres.ps1

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#Requires -Version 7.0
21

32
# This script starts a PostgreSQL database in a docker container, which is required for running tests locally.
43
# When the -UI switch is passed, pgAdmin (a web-based PostgreSQL management tool) is started in a second container, which lets you query the database.

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();
@@ -503,7 +504,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
503504
type = "supportTickets",
504505
id = existingTicket2.StringId,
505506
meta = identifierMeta2
506-
},
507+
}
507508
},
508509
meta = documentMeta
509510
};

0 commit comments

Comments
 (0)