Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
interface A {
field: String
}

type B {
field: C
}

type C {
field: D
}

union D = E | F

type E {
e: String
}

type F implements A {
field: String
}
16 changes: 13 additions & 3 deletions packages/import/tests/schema/fixtures/unions/c.graphql
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
interface I {
c4: ID
}

type C1 {
c1: ID
}

type C2 {
c2: ID
c2: C3
}

union C3 = C4 | C5

type C4 implements I {
c4: ID
}

type C3 {
c3: ID
type C5 {
C5: ID
}
32 changes: 32 additions & 0 deletions packages/import/tests/schema/import-schema.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -953,6 +953,38 @@ describe('importSchema', () => {
expect(importSchema('fixtures/multiple-levels/level1.graphql')).toBeSimilarGqlDoc(expectedSDL);
});

test('imports with union dependencies', () => {
const expectedSDL = /* GraphQL */ `
type A {
b: B
}
union B = C1 | C2

interface I {
c4: ID
}

type C1 {
c1: ID
}

type C2 {
c2: C3
}

union C3 = C4 | C5

type C4 implements I {
c4: ID
}

type C5 {
C5: ID
}
`;
expect(importSchema('fixtures/unions/a.graphql')).toBeSimilarGqlDoc(expectedSDL);
});

test('imports dependencies at least 3 levels deep with transitive dependencies while using master schemata', () => {
const expectedSDL = /* GraphQL */ `
type Account {
Expand Down