From adf356a9b280e7f36d9c118fcd63723f71b38f32 Mon Sep 17 00:00:00 2001 From: dnwpark Date: Fri, 24 May 2024 11:05:07 -0400 Subject: [PATCH] Add tests. --- tests/test_schema.py | 53 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/tests/test_schema.py b/tests/test_schema.py index a14d3e72761..bb12307d4d7 100644 --- a/tests/test_schema.py +++ b/tests/test_schema.py @@ -1641,6 +1641,21 @@ def test_schema_rewrite_order_01(self): } """ + def test_schema_rewrite_order_02(self): + # One of the properties is going to reference the other property + # before it is created in its rewrite via __specified__. + # Ensure that this gets ordered correctly. + """ + type User { + property foo -> bool { + rewrite insert using (__specified__.bar); + }; + property bar -> bool { + rewrite insert using (__specified__.foo); + }; + }; + """ + def test_schema_scalar_order_01(self): # Make sure scalar types account for base types when tracing SDL # dependencies. @@ -9111,6 +9126,44 @@ def test_schema_migrations_rewrites_01(self): """, ]) + def test_schema_migrations_rewrites_02(self): + self._assert_migration_equivalence([ + r""" + type User { + property foo -> bool; + property bar -> bool; + }; + """, + r""" + type User { + property foo -> bool { + rewrite insert using ( + __specified__.bar and __specified__.baz + ); + }; + property bar -> bool { + rewrite insert using ( + __specified__.foo and __specified__.baz + ); + }; + property baz -> bool { + rewrite insert using ( + __specified__.foo and __specified__.bar + ); + }; + }; + """, + r""" + type User { + property foo -> bool; + property bar -> bool; + property baz -> bool; + }; + """, + r""" + """, + ]) + def test_schema_migrations_implicit_type_01(self): self._assert_migration_equivalence([ r"""