Skip to content

Commit

Permalink
add test for no changes and update snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
evans committed Aug 21, 2019
1 parent 63a7c87 commit 3d99cc0
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -316,9 +316,20 @@ exports[`service:check markdown formatting is correct with no breaking changes 1
"
### Apollo Service Check
🔄 Validated your local schema against schema tag \`staging\` on graph \`engine\`.
🔢 Compared **0 schema changes** against **100 operations** seen over the **last 24 hours**.
🔢 Compared **1 schema change** against **100 operations** seen over the **last 24 hours**.
✅ Found **no breaking changes**.
🔗 [View your service check details](https://engine-dev.apollographql.com/service/engine/checks?schemaTag=Detached%3A%20d664f715645c5f0bb5ad4f2260cd6cb8d19bbc68&schemaTagId=f9f68e7e-1b5f-4eab-a3da-1fd8cd681111&from=2019-03-26T22%3A25%3A12.887Z?graphCompositionId=fff).
"
`;

exports[`service:check markdown formatting is correct with no changes 1`] = `
"
### Apollo Service Check
🔄 Validated your local schema against schema tag \`staging\` on graph \`engine\`.
✅ Found **no changes**.
🔗 [View your service check details](https://engine-dev.apollographql.com/service/engine/checks?schemaTag=Detached%3A%20d664f715645c5f0bb5ad4f2260cd6cb8d19bbc68&schemaTagId=f9f68e7e-1b5f-4eab-a3da-1fd8cd681111&from=2019-03-26T22%3A25%3A12.887Z?graphCompositionId=fff).
"
`;
30 changes: 29 additions & 1 deletion packages/apollo/src/commands/service/__tests__/check.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import chalk from "chalk";
import nock = require("nock");
import { stdout, stderr } from "stdout-stderr";
import * as graphql from "graphql";
import { graphqlTypes } from "apollo-language-server";

/**
* Single URL for all local requests to be mocked
Expand Down Expand Up @@ -696,7 +697,34 @@ describe("service:check", () => {
severity: ChangeSeverity.NOTICE,
affectedClients: [],
affectedQueries: [],
changes: []
changes: [
{
__typename: "Change",
code: "FIELD_ADDED",
severity: ChangeSeverity.NOTICE
} as graphqlTypes.CheckSchema_service_checkSchema_diffToPrevious_changes
]
}
},
graphCompositionID: "fff"
})
).toMatchSnapshot();
});

it("is correct with no changes", () => {
expect(
formatMarkdown({
graphName: "engine",
tag: "staging",
checkSchemaResult: {
...checkSchemaResult,
diffToPrevious: {
...checkSchemaResult.diffToPrevious,
severity: ChangeSeverity.NOTICE,
affectedClients: [],
affectedQueries: [],
changes: [],
validationConfig: null
}
},
graphCompositionID: "fff"
Expand Down

0 comments on commit 3d99cc0

Please sign in to comment.