Skip to content

Commit

Permalink
chore: add controlplane tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Aenimus committed Oct 24, 2024
1 parent c2695e2 commit 1896d33
Show file tree
Hide file tree
Showing 7 changed files with 810 additions and 83 deletions.
48 changes: 24 additions & 24 deletions composition-go/index.global.js

Large diffs are not rendered by default.

13 changes: 0 additions & 13 deletions composition/src/federation/federation-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2615,19 +2615,6 @@ export class FederationFactory {
]);
this.inaccessiblePaths.add(`${parentTypeName}.${fieldName}`);
accessibleFields -= 1;
continue;
}
for (const [argumentName, inputValueData] of fieldData.argumentDataByArgumentName) {
if (isNodeDataInaccessible(inputValueData)) {
continue;
}
const argumentTagNames = childTagData.tagNamesByArgumentName.get(argumentName);
if (!argumentTagNames || !doSetsIntersect(argumentTagNames, argumentTagNames)) {
getValueOrDefault(inputValueData.persistedDirectivesData.directives, INACCESSIBLE, () => [
generateSimpleDirective(INACCESSIBLE),
]);
this.inaccessiblePaths.add(inputValueData.renamedPath);
}
}
}
if (accessibleFields < 1) {
Expand Down
34 changes: 34 additions & 0 deletions composition/tests/contracts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -802,6 +802,26 @@ describe('Contract tests', () => {
);
});

test('that if a Field is included, its Arguments are included by default', () => {
const { errors, federationResult } = federateSubgraphsContract([subgraphInclude, subgraphAL], includedTagsOne);
expect(errors).toBeUndefined();
expect(schemaToSortedNormalizedString(federationResult!.federatedGraphClientSchema)).toBe(
normalizeString(
schemaQueryDefinition +
`
type Object {
name: String!
}
type Query {
field(input: ID!): Object!
include: Int!
}
`,
),
);
});

test('that a Scalar is included by tag', () => {
const { errors, federationResult } = federateSubgraphsContract(
[subgraphInclude, subgraphQ, subgraphR],
Expand Down Expand Up @@ -2880,3 +2900,17 @@ const subgraphAK: Subgraph = {
}
`),
};

const subgraphAL: Subgraph = {
name: 'subgraph-al',
url: '',
definitions: parse(`
type Object @tag(name: "one") {
name: String!
}
type Query {
field(input: ID!): Object! @tag(name: "one")
}
`),
};
Loading

0 comments on commit 1896d33

Please sign in to comment.