@@ -160,5 +160,52 @@ describe(GroupQuery.name, () => {
160160 const result = query . queryMembers ( ) ;
161161 expect ( result ) . toEqual ( [ ] ) ;
162162 } ) ;
163+
164+ it ( "does not return a member from wrong group" , ( ) => {
165+ const store = graph ( ) ;
166+ const groupNode = sym (
167+ "http://pod.test/alice/contacts/1/group/1/index.ttl#this" ,
168+ ) ;
169+ const wrongGroup = sym (
170+ "http://pod.test/alice/contacts/1/group/wrong/index.ttl#this" ,
171+ ) ;
172+ store . add (
173+ wrongGroup ,
174+ vcard ( "hasMember" ) ,
175+ sym ( "http://pod.test/alice/contacts/Person/1#this" ) ,
176+ groupNode . doc ( ) ,
177+ ) ;
178+ store . add (
179+ sym ( "http://pod.test/alice/contacts/Person/1#this" ) ,
180+ vcard ( "fn" ) ,
181+ lit ( "Bob" ) ,
182+ groupNode . doc ( ) ,
183+ ) ;
184+ const query = new GroupQuery ( store , groupNode ) ;
185+ const result = query . queryMembers ( ) ;
186+ expect ( result ) . toEqual ( [ ] ) ;
187+ } ) ;
188+
189+ it ( "does not return a member from wrong group document" , ( ) => {
190+ const store = graph ( ) ;
191+ const groupNode = sym (
192+ "http://pod.test/alice/contacts/1/group/1/index.ttl#this" ,
193+ ) ;
194+ store . add (
195+ groupNode ,
196+ vcard ( "hasMember" ) ,
197+ sym ( "http://pod.test/alice/contacts/Person/1#this" ) ,
198+ sym ( "http://pod.test/wrong/contacts/Person/1#this" ) ,
199+ ) ;
200+ store . add (
201+ sym ( "http://pod.test/alice/contacts/Person/1#this" ) ,
202+ vcard ( "fn" ) ,
203+ lit ( "Bob" ) ,
204+ groupNode . doc ( ) ,
205+ ) ;
206+ const query = new GroupQuery ( store , groupNode ) ;
207+ const result = query . queryMembers ( ) ;
208+ expect ( result ) . toEqual ( [ ] ) ;
209+ } ) ;
163210 } ) ;
164211} ) ;
0 commit comments