Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mayakoneval committed May 2, 2023
1 parent c097098 commit 9a0d2ab
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ describe('Embedded Explorer Landing Page Config HTML', () => {
},
graphRef: 'graph@current',
};
expect(getEmbeddedExplorerHTML(cdnVersion, config, apolloServerVersion))
.toMatchInlineSnapshot(`
expect(
getEmbeddedExplorerHTML(cdnVersion, config, apolloServerVersion, 'nonce'),
).toMatchInlineSnapshot(`
<div class="fallback">
<h1>
Welcome to Apollo Server
Expand All @@ -49,9 +50,11 @@ 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?runtime=%40apollo%2Fserver%404.0.0">
<script nonce="nonce"
src="https://embeddable-explorer.cdn.apollographql.com/_latest/embeddable-explorer.umd.production.min.js?runtime=%40apollo%2Fserver%404.0.0"
>
</script>
<script>
<script nonce="nonce">
var endpointUrl = window.location.href;
var embeddedExplorerConfig = {"graphRef":"graph@current","target":"#embeddableExplorer","initialState":{"document":"query Test { id }","headers":{"authorization":"true"},"variables":{"option":{"a":"val","b":1,"c":true}},"displayOptions":{"showHeadersAndEnvVars":true,"docsPanelState":"open","theme":"light"}},"persistExplorerState":true,"includeCookies":true,"runtime":"@apollo/server@4.0.0"};
new window.EmbeddedExplorer({
Expand All @@ -70,8 +73,9 @@ describe('Embedded Explorer Landing Page Config HTML', () => {
embed: true,
graphRef: 'graph@current',
};
expect(getEmbeddedExplorerHTML(cdnVersion, config, apolloServerVersion))
.toMatchInlineSnapshot(`
expect(
getEmbeddedExplorerHTML(cdnVersion, config, apolloServerVersion, 'nonce'),
).toMatchInlineSnapshot(`
<div class="fallback">
<h1>
Welcome to Apollo Server
Expand All @@ -89,9 +93,11 @@ 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?runtime=%40apollo%2Fserver%404.0.0">
<script nonce="nonce"
src="https://embeddable-explorer.cdn.apollographql.com/_latest/embeddable-explorer.umd.production.min.js?runtime=%40apollo%2Fserver%404.0.0"
>
</script>
<script>
<script nonce="nonce">
var endpointUrl = window.location.href;
var embeddedExplorerConfig = {"graphRef":"graph@current","target":"#embeddableExplorer","initialState":{"headers":{"authorization":"true"},"displayOptions":{}},"persistExplorerState":false,"includeCookies":true,"runtime":"@apollo/server@4.0.0"};
new window.EmbeddedExplorer({
Expand All @@ -111,8 +117,9 @@ describe('Embedded Explorer Landing Page Config HTML', () => {
embed: true,
graphRef: 'graph@current',
};
expect(getEmbeddedExplorerHTML(cdnVersion, config, apolloServerVersion))
.toMatchInlineSnapshot(`
expect(
getEmbeddedExplorerHTML(cdnVersion, config, apolloServerVersion, 'nonce'),
).toMatchInlineSnapshot(`
<div class="fallback">
<h1>
Welcome to Apollo Server
Expand All @@ -130,9 +137,11 @@ 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?runtime=%40apollo%2Fserver%404.0.0">
<script nonce="nonce"
src="https://embeddable-explorer.cdn.apollographql.com/_latest/embeddable-explorer.umd.production.min.js?runtime=%40apollo%2Fserver%404.0.0"
>
</script>
<script>
<script nonce="nonce">
var endpointUrl = window.location.href;
var embeddedExplorerConfig = {"graphRef":"graph@current","target":"#embeddableExplorer","initialState":{"collectionId":"12345","operationId":"abcdef","displayOptions":{}},"persistExplorerState":false,"includeCookies":true,"runtime":"@apollo/server@4.0.0"};
new window.EmbeddedExplorer({
Expand All @@ -150,8 +159,9 @@ describe('Embedded Explorer Landing Page Config HTML', () => {
embed: true,
graphRef: 'graph@current',
};
expect(getEmbeddedExplorerHTML(cdnVersion, config, apolloServerVersion))
.toMatchInlineSnapshot(`
expect(
getEmbeddedExplorerHTML(cdnVersion, config, apolloServerVersion, 'nonce'),
).toMatchInlineSnapshot(`
<div class="fallback">
<h1>
Welcome to Apollo Server
Expand All @@ -169,9 +179,11 @@ 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?runtime=%40apollo%2Fserver%404.0.0">
<script nonce="nonce"
src="https://embeddable-explorer.cdn.apollographql.com/_latest/embeddable-explorer.umd.production.min.js?runtime=%40apollo%2Fserver%404.0.0"
>
</script>
<script>
<script nonce="nonce">
var endpointUrl = window.location.href;
var embeddedExplorerConfig = {"graphRef":"graph@current","target":"#embeddableExplorer","initialState":{"displayOptions":{}},"persistExplorerState":false,"includeCookies":false,"runtime":"@apollo/server@4.0.0"};
new window.EmbeddedExplorer({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ describe('Landing Page Config HTML', () => {
headers: { authorization: 'true' },
embed: true,
};
expect(getEmbeddedSandboxHTML(cdnVersion, config, apolloServerVersion))
.toMatchInlineSnapshot(`
expect(
getEmbeddedSandboxHTML(cdnVersion, config, apolloServerVersion, 'nonce'),
).toMatchInlineSnapshot(`
<div class="fallback">
<h1>
Welcome to Apollo Server
Expand All @@ -40,9 +41,11 @@ describe('Landing Page Config HTML', () => {
id="embeddableSandbox"
>
</div>
<script src="https://embeddable-sandbox.cdn.apollographql.com/_latest/embeddable-sandbox.umd.production.min.js?runtime=%40apollo%2Fserver%404.0.0">
<script nonce="nonce"
src="https://embeddable-sandbox.cdn.apollographql.com/_latest/embeddable-sandbox.umd.production.min.js?runtime=%40apollo%2Fserver%404.0.0"
>
</script>
<script>
<script nonce="nonce">
var initialEndpoint = window.location.href;
new window.EmbeddedSandbox({
target: '#embeddableSandbox',
Expand All @@ -62,8 +65,9 @@ describe('Landing Page Config HTML', () => {
headers: { authorization: 'true' },
embed: true,
};
expect(getEmbeddedSandboxHTML(cdnVersion, config, apolloServerVersion))
.toMatchInlineSnapshot(`
expect(
getEmbeddedSandboxHTML(cdnVersion, config, apolloServerVersion, 'nonce'),
).toMatchInlineSnapshot(`
<div class="fallback">
<h1>
Welcome to Apollo Server
Expand All @@ -81,9 +85,11 @@ describe('Landing Page Config HTML', () => {
id="embeddableSandbox"
>
</div>
<script src="https://embeddable-sandbox.cdn.apollographql.com/_latest/embeddable-sandbox.umd.production.min.js?runtime=%40apollo%2Fserver%404.0.0">
<script nonce="nonce"
src="https://embeddable-sandbox.cdn.apollographql.com/_latest/embeddable-sandbox.umd.production.min.js?runtime=%40apollo%2Fserver%404.0.0"
>
</script>
<script>
<script nonce="nonce">
var initialEndpoint = window.location.href;
new window.EmbeddedSandbox({
target: '#embeddableSandbox',
Expand All @@ -101,8 +107,9 @@ describe('Landing Page Config HTML', () => {
const config: ApolloServerPluginEmbeddedLandingPageLocalDefaultOptions = {
embed: true,
};
expect(getEmbeddedSandboxHTML(cdnVersion, config, apolloServerVersion))
.toMatchInlineSnapshot(`
expect(
getEmbeddedSandboxHTML(cdnVersion, config, apolloServerVersion, 'nonce'),
).toMatchInlineSnapshot(`
<div class="fallback">
<h1>
Welcome to Apollo Server
Expand All @@ -120,9 +127,11 @@ describe('Landing Page Config HTML', () => {
id="embeddableSandbox"
>
</div>
<script src="https://embeddable-sandbox.cdn.apollographql.com/_latest/embeddable-sandbox.umd.production.min.js?runtime=%40apollo%2Fserver%404.0.0">
<script nonce="nonce"
src="https://embeddable-sandbox.cdn.apollographql.com/_latest/embeddable-sandbox.umd.production.min.js?runtime=%40apollo%2Fserver%404.0.0"
>
</script>
<script>
<script nonce="nonce">
var initialEndpoint = window.location.href;
new window.EmbeddedSandbox({
target: '#embeddableSandbox',
Expand All @@ -142,8 +151,9 @@ describe('Landing Page Config HTML', () => {
operationId: 'abcdef',
embed: true,
};
expect(getEmbeddedSandboxHTML(cdnVersion, config, apolloServerVersion))
.toMatchInlineSnapshot(`
expect(
getEmbeddedSandboxHTML(cdnVersion, config, apolloServerVersion, 'nonce'),
).toMatchInlineSnapshot(`
<div class="fallback">
<h1>
Welcome to Apollo Server
Expand All @@ -161,9 +171,11 @@ describe('Landing Page Config HTML', () => {
id="embeddableSandbox"
>
</div>
<script src="https://embeddable-sandbox.cdn.apollographql.com/_latest/embeddable-sandbox.umd.production.min.js?runtime=%40apollo%2Fserver%404.0.0">
<script nonce="nonce"
src="https://embeddable-sandbox.cdn.apollographql.com/_latest/embeddable-sandbox.umd.production.min.js?runtime=%40apollo%2Fserver%404.0.0"
>
</script>
<script>
<script nonce="nonce">
var initialEndpoint = window.location.href;
new window.EmbeddedSandbox({
target: '#embeddableSandbox',
Expand All @@ -188,8 +200,9 @@ describe('Landing Page Config HTML', () => {
},
},
};
expect(getEmbeddedSandboxHTML(cdnVersion, config, apolloServerVersion))
.toMatchInlineSnapshot(`
expect(
getEmbeddedSandboxHTML(cdnVersion, config, apolloServerVersion, 'nonce'),
).toMatchInlineSnapshot(`
<div class="fallback">
<h1>
Welcome to Apollo Server
Expand All @@ -207,9 +220,11 @@ describe('Landing Page Config HTML', () => {
id="embeddableSandbox"
>
</div>
<script src="https://embeddable-sandbox.cdn.apollographql.com/_latest/embeddable-sandbox.umd.production.min.js?runtime=%40apollo%2Fserver%404.0.0">
<script nonce="nonce"
src="https://embeddable-sandbox.cdn.apollographql.com/_latest/embeddable-sandbox.umd.production.min.js?runtime=%40apollo%2Fserver%404.0.0"
>
</script>
<script>
<script nonce="nonce">
var initialEndpoint = window.location.href;
new window.EmbeddedSandbox({
target: '#embeddableSandbox',
Expand Down

0 comments on commit 9a0d2ab

Please sign in to comment.