Skip to content

Commit f1e9f4e

Browse files
committed
test: cover Berlin Group v1.3 alias in resource-doc registry parity test
The alias surface is gated by berlin_group_v1_3_alias_path, which is unset in the default test environment, so its operation-id list is legitimately empty there -- skip the non-empty assertion for it while still running the membership check against getAllResourceDocs.
1 parent 6ad14de commit f1e9f4e

1 file changed

Lines changed: 20 additions & 14 deletions

File tree

‎obp-api/src/test/scala/code/api/util/ResourceDocRegistryParityTest.scala‎

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@ import org.scalatest.Tag
1111
*
1212
* These are two parallel registries (ResourceDocsAPIMethods dispatches per
1313
* standard/version; getAllResourceDocs aggregates them all), and they have drifted
14-
* twice: Berlin Group v2 was served by the dispatcher but missing from the global
15-
* registry (so BGv2-getAccountDetails could not be added to an API collection),
16-
* and the global registry was based on the v6 aggregation, excluding v7-only
17-
* operation ids. When you add a NEW API standard, register its docs in BOTH
18-
* places — and add its surface to this list.
14+
* three times: Berlin Group v2 was served by the dispatcher but missing from the
15+
* global registry (so BGv2-getAccountDetails could not be added to an API
16+
* collection), the global registry was based on the v6 aggregation, excluding
17+
* v7-only operation ids, and the Berlin Group v1.3 alias (active only when
18+
* berlin_group_v1_3_alias_path is set) was missing too. When you add a NEW API
19+
* standard, register its docs in BOTH places — and add its surface to this list.
1920
*/
2021
class ResourceDocRegistryParityTest extends ServerSetup {
2122

@@ -24,19 +25,24 @@ class ResourceDocRegistryParityTest extends ServerSetup {
2425
private lazy val allOperationIds: Set[String] =
2526
APIUtil.getAllResourceDocs.map(_.operationId).toSet
2627

27-
private lazy val surfaces: List[(String, Seq[String])] = List(
28-
("OBP standard (v7 aggregation)", code.api.v7_0_0.Http4s700.allResourceDocs.map(_.operationId).toSeq),
29-
("Berlin Group v1.3", code.api.berlin.group.v1_3.Http4sBGv13.resourceDocs.map(_.operationId).toSeq),
30-
("Berlin Group v2", code.api.berlin.group.v2.Http4sBGv2.resourceDocs.map(_.operationId).toSeq),
31-
("UK Open Banking 2.0.0", code.api.UKOpenBanking.v2_0_0.OBP_UKOpenBanking_200.allResourceDocs.map(_.operationId).toSeq),
32-
("UK Open Banking 3.1.0", code.api.UKOpenBanking.v3_1_0.OBP_UKOpenBanking_310.allResourceDocs.map(_.operationId).toSeq),
33-
("UK Open Banking 4.0.1", code.api.UKOpenBanking.v4_0_1.OBP_UKOpenBanking_401.allResourceDocs.map(_.operationId).toSeq)
28+
// optional=true surfaces are gated by a prop that is unset by default (test props
29+
// included), so their operation-id list is legitimately empty in most environments --
30+
// the membership check still runs (trivially true when empty) but the non-empty
31+
// assertion is skipped for them.
32+
private lazy val surfaces: List[(String, Seq[String], Boolean)] = List(
33+
("OBP standard (v7 aggregation)", code.api.v7_0_0.Http4s700.allResourceDocs.map(_.operationId).toSeq, false),
34+
("Berlin Group v1.3", code.api.berlin.group.v1_3.Http4sBGv13.resourceDocs.map(_.operationId).toSeq, false),
35+
("Berlin Group v1.3 alias", code.api.berlin.group.v1_3.Http4sBGv13Alias.resourceDocs.map(_.operationId).toSeq, true),
36+
("Berlin Group v2", code.api.berlin.group.v2.Http4sBGv2.resourceDocs.map(_.operationId).toSeq, false),
37+
("UK Open Banking 2.0.0", code.api.UKOpenBanking.v2_0_0.OBP_UKOpenBanking_200.allResourceDocs.map(_.operationId).toSeq, false),
38+
("UK Open Banking 3.1.0", code.api.UKOpenBanking.v3_1_0.OBP_UKOpenBanking_310.allResourceDocs.map(_.operationId).toSeq, false),
39+
("UK Open Banking 4.0.1", code.api.UKOpenBanking.v4_0_1.OBP_UKOpenBanking_401.allResourceDocs.map(_.operationId).toSeq, false)
3440
)
3541

3642
feature("getAllResourceDocs contains every per-standard resource-doc surface") {
37-
surfaces.foreach { case (label, operationIds) =>
43+
surfaces.foreach { case (label, operationIds, optional) =>
3844
scenario(s"$label operation ids are all resolvable globally", RegistryParityTag) {
39-
operationIds should not be empty
45+
if (!optional) operationIds should not be empty
4046
val missing = operationIds.filterNot(allOperationIds.contains)
4147
withClue(s"$label operation ids missing from getAllResourceDocs: ${missing.take(10).mkString(", ")} ") {
4248
missing shouldBe empty

0 commit comments

Comments
 (0)