Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(os-178): fixed failing tests #6358

Merged
merged 1 commit into from
Sep 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ describe('[commercetools-helpers] handleBeforeAuth', () => {
it('doesnt generate access token for guest on users related operations', async () => {
const scope = '';
const result = await handleBeforeAuth({
settings: {},
sdkAuth: getSdkAuth(scope),
tokenProvider: getTokenProvider(scope),
apolloReq: { operationName: 'customerSignMeIn' },
Expand All @@ -31,6 +32,7 @@ describe('[commercetools-helpers] handleBeforeAuth', () => {
it('generates access token for guest on anonymous-session allowed operations', async () => {
const scope = '';
const result = await handleBeforeAuth({
settings: {},
sdkAuth: getSdkAuth(scope),
tokenProvider: getTokenProvider(scope),
apolloReq: { operationName: 'createCart' },
Expand All @@ -43,6 +45,7 @@ describe('[commercetools-helpers] handleBeforeAuth', () => {
it('returns current token for anonymous user', async () => {
const scope = 'anonymous_id';
const result = await handleBeforeAuth({
settings: {},
sdkAuth: getSdkAuth(scope),
tokenProvider: getTokenProvider(scope),
apolloReq: { operationName: 'customerSignMeIn' },
Expand All @@ -55,6 +58,7 @@ describe('[commercetools-helpers] handleBeforeAuth', () => {
it('returns current token for logged in user', async () => {
const scope = 'customer_id';
const result = await handleBeforeAuth({
settings: {},
sdkAuth: getSdkAuth(scope),
tokenProvider: getTokenProvider(scope),
apolloReq: { operationName: 'customerSignMeIn' },
Expand Down Expand Up @@ -140,7 +144,7 @@ describe('[commercetools-helpers] handleRetry', () => {

it('defaults to false', () => {
const tokenProvider = getTokenProvider('');
const handler = handleRetry({ tokenProvider });
const handler = handleRetry({ settings: {}, tokenProvider });
const operation = { operationName: 'any' };
const error = { result: { message: '' } };

Expand All @@ -150,7 +154,7 @@ describe('[commercetools-helpers] handleRetry', () => {

it('doesnt run more than 3 times', () => {
const tokenProvider = getTokenProvider('');
const handler = handleRetry({ tokenProvider });
const handler = handleRetry({ settings: {}, tokenProvider });
const operation = { operationName: 'any' };
const error = { result: { message: 'invalid_token' } };

Expand All @@ -160,7 +164,7 @@ describe('[commercetools-helpers] handleRetry', () => {

it('calls "invalidateTokenInfo" on "invalid_token" error', () => {
const tokenProvider = getTokenProvider('');
const handler = handleRetry({ tokenProvider });
const handler = handleRetry({ settings: {}, tokenProvider });
const operation = { operationName: 'any' };
const error = { result: { message: 'invalid_token' } };

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ const context = {
}
}
})),
getCategory: jest.fn(() => ({
categorySearch: jest.fn(() => ({
data: {
categories: {
categorySearch: {
results: [{ id: 1, name: 'cat1' }]
}
}
Expand Down Expand Up @@ -61,7 +61,7 @@ describe('[commercetools-composables] useFacet', () => {
}
} as any);

expect(context.$ct.api.getCategory).toBeCalled();
expect(context.$ct.api.categorySearch).toBeCalled();
expect(context.$ct.api.getProduct).toBeCalled();
expect(enhanceProduct).toBeCalled();
expect(getFiltersFromProductsAttributes).toBeCalled();
Expand Down