Skip to content
This repository has been archived by the owner on Oct 1, 2024. It is now read-only.

Commit

Permalink
small unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
keyfer committed Aug 26, 2020
1 parent 2fcac74 commit 511e088
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/koa-shopify-auth/src/auth/redirection-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default function redirectionScript({origin, redirectTo, apiKey}) {
var Redirect = AppBridge.actions.Redirect;
var app = createApp({
apiKey: '${apiKey}',
shopOrigin: '${encodeURI(origin)}',
shopOrigin: "${encodeURI(origin)}",
});
var redirect = Redirect.create(app);
redirect.dispatch(Redirect.Action.REMOTE, '${redirectTo}');
Expand Down
15 changes: 15 additions & 0 deletions packages/koa-shopify-auth/src/auth/test/redirection-page.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import redirectionScript from '../redirection-page';

const origin = 'https://shopify.com/?x=шеллы';
const redirectTo = 'shop1.myshopify.io';
const apiKey = 'fakekey';

describe('redirectionScript', () => {
it('returns a script tag with formatted data', () => {
const script = redirectionScript({origin, redirectTo, apiKey});

expect(script).toContain(
'shopOrigin: "https://shopify.com/?x=%D1%88%D0%B5%D0%BB%D0%BB%D1%8B"',
);
});
});

0 comments on commit 511e088

Please sign in to comment.