test: relationship populates with locale

This commit is contained in:
Dan Ribbens
2022-07-18 12:19:35 -04:00
parent a103665bd9
commit cc8b636248

View File

@@ -318,6 +318,16 @@ describe('Localization', () => {
expect(result2.docs[0].id).toEqual(withRelationship.id);
});
it('relationship population uses locale', async () => {
const result = await payload.findByID<WithLocalizedRelationship>({
collection: withLocalizedRelSlug,
depth: 1,
id: withRelationship.id,
locale: spanishLocale,
});
expect((result.localizedRelationship as LocalizedPost).title).toEqual(relationSpanishTitle);
});
it('all locales', async () => {
const queryRelation = (where: Where) => {
return payload.find<WithLocalizedRelationship>({