Skip to content
This repository has been archived by the owner on Nov 28, 2022. It is now read-only.

Commit

Permalink
Correct cookie usage in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
uppal101 committed Sep 18, 2017
1 parent 6e3ff4e commit c97197f
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions packages/api-explorer-ui/__tests__/index.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ describe('selected language', () => {

describe('Cookie', () => {
test('the state of language should be set to Cookie value if provided', () => {
const languageCookie = Cookie.set('readme_language', 'javascript');
Cookie.set('readme_language', 'javascript');
const languages = ['node', 'curl'];
const explorer = shallow(
<ApiExplorer
Expand All @@ -70,7 +70,6 @@ describe('selected language', () => {
[extensions.SAMPLES_LANGUAGES]: languages,
}),
}}
cookie={languageCookie}
/>,
);

Expand All @@ -79,7 +78,7 @@ describe('selected language', () => {
});

test('the state of language should be the first language defined if cookie has not been set', () => {
const languageCookie = Cookie.remove('readme_language');
Cookie.remove('readme_language');
const languages = ['node', 'curl'];
const explorer = shallow(
<ApiExplorer
Expand All @@ -89,22 +88,20 @@ describe('selected language', () => {
[extensions.SAMPLES_LANGUAGES]: languages,
}),
}}
cookie={languageCookie}
/>,
);

expect(explorer.state('language')).toBe('node');
});

test('the state of language should be defaulted to curl if no cookie is present and languages have not been defined', () => {
const languageCookie = Cookie.remove('readme_language');
Cookie.remove('readme_language');
const explorer = shallow(
<ApiExplorer
docs={docs}
oasFiles={{
'api-setting': Object.assign({}, oas),
}}
cookie={languageCookie}
/>,
);

Expand Down

0 comments on commit c97197f

Please sign in to comment.