|
|
|
@ -36,6 +36,8 @@ namespace Squidex.Domain.Apps.Core.Operations.ExtractReferenceIds |
|
|
|
.AddNumber(3, "field3", Partitioning.Invariant) |
|
|
|
.AddAssets(5, "assets1", Partitioning.Invariant) |
|
|
|
.AddAssets(6, "assets2", Partitioning.Invariant) |
|
|
|
.AddArray(7, "array", Partitioning.Invariant, a => a |
|
|
|
.AddAssets(71, "assets71")) |
|
|
|
.AddJson(4, "json", Partitioning.Language) |
|
|
|
.UpdateField(3, f => f.Hide()); |
|
|
|
} |
|
|
|
@ -159,6 +161,27 @@ namespace Squidex.Domain.Apps.Core.Operations.ExtractReferenceIds |
|
|
|
Assert.Same(token, result); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public void Should_return_ids_from_nested_references_field() |
|
|
|
{ |
|
|
|
var id1 = Guid.NewGuid(); |
|
|
|
var id2 = Guid.NewGuid(); |
|
|
|
|
|
|
|
var sut = |
|
|
|
Fields.Array(1, "my-array", Partitioning.Invariant, |
|
|
|
Fields.References(1, "my-refs", |
|
|
|
new ReferencesFieldProperties { SchemaId = schemaId })); |
|
|
|
|
|
|
|
var value = |
|
|
|
new JArray( |
|
|
|
new JObject( |
|
|
|
new JProperty("my-refs", CreateValue(id1, id2)))); |
|
|
|
|
|
|
|
var result = sut.ExtractReferences(value).ToArray(); |
|
|
|
|
|
|
|
Assert.Equal(new[] { id1, id2, schemaId }, result); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public void Should_return_ids_from_references_field() |
|
|
|
{ |
|
|
|
|