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 711bf03
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .changeset/many-shirts-kneel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
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 711bf03

Please sign in to comment.