Skip to content

Commit

Permalink
export SandboxEndpoints (#125)
Browse files Browse the repository at this point in the history
Updates answers-headless to the next alpha version which now exports a
SandboxEndpoints object.

J=SLAP-2106
TEST=auto

added test for checking that an answers config is passed from AnswersHeadlessProvider
to provideAnswersHeadless without the endpoints being altered
  • Loading branch information
oshi97 committed May 30, 2022
1 parent af446b0 commit 65127b8
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 21 deletions.
12 changes: 9 additions & 3 deletions THIRD-PARTY-NOTICES
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,19 @@ SOFTWARE.

The following NPM package may be included in this product:

- @yext/answers-core@1.6.0-beta.7
- @yext/answers-core@1.7.0-alpha.165

This package contains the following license and notice below:

The Answers Core files listed in this repository are licensed under the below license.  All other features and products are subject to separate agreements
and certain functionality requires paid subscriptions to Yext products.

Contains information from the language-subtag-registry JSON Database (https://github.com/mattcg/language-subtag-registry/tree/master/data/json)
which is made available under the ODC Attribution License (https://github.com/mattcg/language-subtag-registry/blob/master/LICENSE.md).

BSD 3-Clause License

Copyright (c) 2021, Yext
Copyright (c) 2022, Yext
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -100,7 +106,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

The following NPM package may be included in this product:

- @yext/answers-headless@1.1.1-alpha.0-95
- @yext/answers-headless@1.1.1-alpha.96

This package contains the following license and notice below:

Expand Down
36 changes: 21 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@yext/answers-headless-react",
"version": "1.1.1-alpha.124",
"version": "1.1.1-alpha.125",
"main": "./lib/esm/src/index.js",
"types": "./lib/esm/src/index.d.ts",
"exports": {
Expand All @@ -21,7 +21,7 @@
"generate-notices": "generate-license-file --input package.json --output THIRD-PARTY-NOTICES --overwrite"
},
"dependencies": {
"@yext/answers-headless": "1.1.1-alpha.0-95",
"@yext/answers-headless": "^1.1.1-alpha.96",
"use-sync-external-store": "^1.1.0"
},
"devDependencies": {
Expand Down Expand Up @@ -95,4 +95,4 @@
"type": "git",
"url": "https://github.com/yext/answers-headless-react.git"
}
}
}
23 changes: 23 additions & 0 deletions tests/AnswersHeadlessProvider.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { AnswersHeadlessProvider, SandboxEndpoints } from '../src';
import { render } from '@testing-library/react';
import { provideAnswersHeadless } from '@yext/answers-headless';

jest.mock('@yext/answers-headless', () => ({
provideAnswersHeadless: jest.fn(() => ({
setSessionTrackingEnabled: jest.fn(),
setSessionId: jest.fn()
}))
}));

it('correctly passes through an answers config with sandbox endpoints', () => {
const config = {
apiKey: '<apiKey>',
experienceKey: '<experienceKey>',
locale: 'en',
endpoints: SandboxEndpoints
};

render(<AnswersHeadlessProvider {...config}/>);
expect(provideAnswersHeadless).toHaveBeenCalledTimes(1);
expect(provideAnswersHeadless).toHaveBeenCalledWith(config, expect.anything());
});

0 comments on commit 65127b8

Please sign in to comment.