Skip to content

Commit

Permalink
add one more case for type without cachecontrol implementing interfac…
Browse files Browse the repository at this point in the history
…e with cachecontrol
  • Loading branch information
trevor-scheer committed Aug 7, 2024
1 parent b66f889 commit feecaca
Showing 1 changed file with 25 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -280,16 +280,22 @@ describe('@cacheControl directives', () => {
it('interaction between type implementing interface, both with specified `maxAge`', async () => {
const schema = buildSchemaWithCacheControlSupport(`
type Query {
droid(id: ID!): Droid
named: Named
droid(id: ID!): Droid
alien(id: ID!): Alien
}
interface Named @cacheControl(maxAge: 60) {
name: String!
}
type Droid implements Named @cacheControl(maxAge: 30) {
id: ID!
name: String!
}
interface Named @cacheControl(maxAge: 60) {
type Alien implements Named {
id: ID!
name: String!
}
`);
Expand Down Expand Up @@ -327,6 +333,23 @@ describe('@cacheControl directives', () => {
expect(hintsDroid).toStrictEqual(
new Map([['droid', { maxAge: 30, scope: undefined }]]),
);

const hintsAlien = await collectCacheControlHints(
schema,
`
query {
alien(id: 3001) {
id
name
}
}
`,
{ defaultMaxAge: 10 }
);

expect(hintsAlien).toStrictEqual(
new Map([['alien', { maxAge: 10, scope: undefined }]]),
);
});

it('inheritMaxAge', async () => {
Expand Down

0 comments on commit feecaca

Please sign in to comment.