@shopify/shopify-app-remix
Version:
Shopify Remix - to simplify the building of Shopify Apps with Remix
26 lines (22 loc) • 716 B
text/typescript
import {APP_BRIDGE_URL} from '../authenticate/const';
import {TEST_SHOP} from './const';
export function expectDocumentRequestHeaders(
response: Response,
isEmbeddedApp = true,
) {
const headers = response.headers;
if (isEmbeddedApp) {
expect(headers.get('Content-Security-Policy')).toEqual(
`frame-ancestors https://${encodeURIComponent(
TEST_SHOP,
)} https://admin.shopify.com https://*.spin.dev https://admin.myshopify.io https://admin.shop.dev;`,
);
expect(headers.get('Link')).toEqual(
`<${APP_BRIDGE_URL}>; rel="preload"; as="script";`,
);
} else {
expect(headers.get('Content-Security-Policy')).toEqual(
`frame-ancestors 'none';`,
);
}
}