Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mayakoneval committed Mar 9, 2023
1 parent cae573f commit 8a7c1d3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import { getEmbeddedExplorerHTML } from '../../../plugin/landingPage/default/get
import type { ApolloServerPluginEmbeddedLandingPageProductionDefaultOptions } from '../../../plugin/landingPage/default/types';
import { describe, it, expect } from '@jest/globals';

const version = '_latest';
const cdnVersion = '_latest';
expect.addSnapshotSerializer(require('jest-serializer-html'));
const apolloServerVersion = '@apollo/server@4.0.0';

describe('Embedded Explorer Landing Page Config HTML', () => {
it('with document, variables, headers and displayOptions provided', () => {
Expand All @@ -29,7 +30,8 @@ describe('Embedded Explorer Landing Page Config HTML', () => {
},
graphRef: 'graph@current',
};
expect(getEmbeddedExplorerHTML(version, config)).toMatchInlineSnapshot(`
expect(getEmbeddedExplorerHTML(cdnVersion, config, apolloServerVersion))
.toMatchInlineSnapshot(`
<div class="fallback">
<h1>
Welcome to Apollo Server
Expand All @@ -47,7 +49,7 @@ describe('Embedded Explorer Landing Page Config HTML', () => {
id="embeddableExplorer"
>
</div>
<script src="https://embeddable-explorer.cdn.apollographql.com/_latest/embeddable-explorer.umd.production.min.js">
<script src="https://embeddable-explorer.cdn.apollographql.com/_latest/embeddable-explorer.umd.production.min.js?referrer=@apollo/server@4.0.0">
</script>
<script>
var endpointUrl = window.location.href;
Expand All @@ -67,7 +69,8 @@ describe('Embedded Explorer Landing Page Config HTML', () => {
embed: true as true,
graphRef: 'graph@current',
};
expect(getEmbeddedExplorerHTML(version, config)).toMatchInlineSnapshot(`
expect(getEmbeddedExplorerHTML(cdnVersion, config, apolloServerVersion))
.toMatchInlineSnapshot(`
<div class="fallback">
<h1>
Welcome to Apollo Server
Expand All @@ -85,7 +88,7 @@ describe('Embedded Explorer Landing Page Config HTML', () => {
id="embeddableExplorer"
>
</div>
<script src="https://embeddable-explorer.cdn.apollographql.com/_latest/embeddable-explorer.umd.production.min.js">
<script src="https://embeddable-explorer.cdn.apollographql.com/_latest/embeddable-explorer.umd.production.min.js?referrer=@apollo/server@4.0.0">
</script>
<script>
var endpointUrl = window.location.href;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import { getEmbeddedSandboxHTML } from '../../../plugin/landingPage/default/getE
import type { LandingPageConfig } from '../../../plugin/landingPage/default/types';
import { describe, it, expect } from '@jest/globals';

const version = '_latest';
const cdnVersion = '_latest';
expect.addSnapshotSerializer(require('jest-serializer-html'));
const apolloServerVersion = '@apollo/server@4.0.0';

describe('Landing Page Config HTML', () => {
it('for embedded sandbox with document, variables and headers provided', () => {
Expand All @@ -20,7 +21,8 @@ describe('Landing Page Config HTML', () => {
headers: { authorization: 'true' },
embed: true,
};
expect(getEmbeddedSandboxHTML(version, config)).toMatchInlineSnapshot(`
expect(getEmbeddedSandboxHTML(cdnVersion, config, apolloServerVersion))
.toMatchInlineSnapshot(`
<div class="fallback">
<h1>
Welcome to Apollo Server
Expand All @@ -38,7 +40,7 @@ describe('Landing Page Config HTML', () => {
id="embeddableSandbox"
>
</div>
<script src="https://embeddable-sandbox.cdn.apollographql.com/_latest/embeddable-sandbox.umd.production.min.js">
<script src="https://embeddable-sandbox.cdn.apollographql.com/_latest/embeddable-sandbox.umd.production.min.js?referrer=@apollo/server@4.0.0">
</script>
<script>
var initialEndpoint = window.location.href;
Expand All @@ -57,7 +59,8 @@ describe('Landing Page Config HTML', () => {
includeCookies: false,
embed: true,
};
expect(getEmbeddedSandboxHTML(version, config)).toMatchInlineSnapshot(`
expect(getEmbeddedSandboxHTML(cdnVersion, config, apolloServerVersion))
.toMatchInlineSnapshot(`
<div class="fallback">
<h1>
Welcome to Apollo Server
Expand All @@ -75,7 +78,7 @@ describe('Landing Page Config HTML', () => {
id="embeddableSandbox"
>
</div>
<script src="https://embeddable-sandbox.cdn.apollographql.com/_latest/embeddable-sandbox.umd.production.min.js">
<script src="https://embeddable-sandbox.cdn.apollographql.com/_latest/embeddable-sandbox.umd.production.min.js?referrer=@apollo/server@4.0.0">
</script>
<script>
var initialEndpoint = window.location.href;
Expand Down

0 comments on commit 8a7c1d3

Please sign in to comment.