Skip to content

Commit ca900c7

Browse files
committed
added test for mutation configuraiton
1 parent 63fe53f commit ca900c7

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

test/analysis/buildTypeWeights.test.ts

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -805,6 +805,10 @@ describe('Test buildTypeWeightsFromSchema function', () => {
805805
user(id: ID!): User
806806
movie(id: ID!): Movie
807807
}
808+
809+
type Mutation {
810+
updateUser(id: ID!, password: String!): User
811+
}
808812
809813
type User {
810814
name: String
@@ -827,6 +831,12 @@ describe('Test buildTypeWeightsFromSchema function', () => {
827831
user: { resolveTo: 'user' },
828832
},
829833
},
834+
mutation: {
835+
weight: 10,
836+
fields: {
837+
updateUser: { resolveTo: 'user' },
838+
},
839+
},
830840
user: {
831841
weight: 1,
832842
fields: {
@@ -854,6 +864,15 @@ describe('Test buildTypeWeightsFromSchema function', () => {
854864
expect(typeWeightObject).toEqual(expectedOutput);
855865
});
856866

867+
test('mutation parameter', () => {
868+
const typeWeightObject = buildTypeWeightsFromSchema(schema, {
869+
mutation: 20,
870+
});
871+
expectedOutput.mutation.weight = 20;
872+
873+
expect(typeWeightObject).toEqual(expectedOutput);
874+
});
875+
857876
test('object parameter', () => {
858877
const typeWeightObject = buildTypeWeightsFromSchema(schema, {
859878
object: 2,
@@ -889,8 +908,6 @@ describe('Test buildTypeWeightsFromSchema function', () => {
889908
expect(typeWeightObject).toEqual(expectedOutput);
890909
});
891910

892-
// TODO: Tests should be written for the remaining configuration options
893-
// mutations
894911
// connections
895912
// subscriptions
896913
});

0 commit comments

Comments
 (0)