Skip to content

Commit b445ed0

Browse files
committed
Add some tests for polymorphic links and QB.
Overall the polymorphic links seem to work in various combinations. There are some issues with typing, though.
1 parent df06039 commit b445ed0

File tree

3 files changed

+913
-45
lines changed

3 files changed

+913
-45
lines changed

tests/dbsetup/orm_qb.edgeql

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,3 +139,93 @@ insert MultiRangeTest {
139139
insert EnumTest {name := 'red', color := Color.Red};
140140
insert EnumTest {name := 'green', color := Color.Green};
141141
insert EnumTest {name := 'blue', color := Color.Blue};
142+
143+
# Poly data
144+
insert Person {
145+
name := 'Alice',
146+
game_id := 1,
147+
};
148+
insert Person {
149+
name := 'Billie',
150+
game_id := 2,
151+
item := (
152+
insert Bag {name := 'nice bag', game_id := 11}
153+
),
154+
};
155+
insert Person {
156+
name := 'Cameron',
157+
game_id := 3,
158+
item := (
159+
insert Box {
160+
name := 'big box',
161+
game_id := 11,
162+
contents := {
163+
# Same type, directly extending abstract Content
164+
(insert Candy {name := 'cotton candy', game_id := 101}),
165+
(insert Candy {name := 'candy corn', game_id := 102}),
166+
}
167+
}
168+
),
169+
};
170+
insert Person {
171+
name := 'Dana',
172+
game_id := 4,
173+
item := (
174+
insert Tin {
175+
name := 'round tin',
176+
game_id := 12,
177+
contents := {
178+
# Tin has to contain Chocolate
179+
(insert Chocolate {
180+
name := 'milk', kind := 'bar', game_id := 3001
181+
}),
182+
(insert Chocolate {
183+
name := 'dark', kind := 'truffle', game_id := 3002
184+
}),
185+
}
186+
}
187+
),
188+
};
189+
insert Person {
190+
name := 'Elsa',
191+
game_id := 5,
192+
item := (
193+
insert Box {
194+
name := 'package',
195+
game_id := 13,
196+
contents := {
197+
(insert Candy {name := 'lemon drop', game_id := 103}),
198+
(insert Chocolate {
199+
name := 'almond', kind := 'piece', game_id := 3003
200+
}),
201+
(insert Gummy {
202+
name := 'blue bear', flavor := 'grape', game_id := 1001
203+
}),
204+
(insert GummyWorm {
205+
name := 'sour worm',
206+
game_id := 2002,
207+
flavor := 'raspberry',
208+
size := 2,
209+
}),
210+
}
211+
}
212+
),
213+
};
214+
insert Person {
215+
name := 'Zoe',
216+
game_id := 6,
217+
item := (
218+
insert GiftBox {
219+
name := 'fancy',
220+
game_id := 14,
221+
contents := {
222+
(insert GummyWorm {
223+
name := 'sour worm',
224+
game_id := 2001,
225+
flavor := 'fruity',
226+
size := 10,
227+
}),
228+
}
229+
}
230+
),
231+
};

0 commit comments

Comments
 (0)