Skip to content

Commit

Permalink
Flag is not language
Browse files Browse the repository at this point in the history
  • Loading branch information
better-owlet committed Jul 21, 2020
1 parent 024de2e commit f0a51c4
Showing 1 changed file with 0 additions and 113 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,119 +23,6 @@ describe('<LocaleToggle />', () => {
shallow(<LocaleToggle {...props} />);
});

describe('<LocaleToggle />, getFlagUrl instance', () => {
it('should return the en flag', () => {
const renderedComponent = shallow(<LocaleToggle {...props} />);
const { getFlagUrl } = renderedComponent.instance();

expect(getFlagUrl('en')).toEqual(
'https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/3.1.0/flags/4x3/us.svg'
);
});

it('should return the pt-BR flag', () => {
const renderedComponent = shallow(<LocaleToggle {...props} />);
const { getFlagUrl } = renderedComponent.instance();

expect(getFlagUrl('pt-BR')).toEqual(
'https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/3.1.0/flags/4x3/br.svg'
);
});

it('should return the zh flag', () => {
const renderedComponent = shallow(<LocaleToggle {...props} />);
const { getFlagUrl } = renderedComponent.instance();

expect(getFlagUrl('zh')).toEqual(
'https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/3.1.0/flags/4x3/tw.svg'
);
expect(getFlagUrl('zh-Hans')).toEqual(
'https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/3.1.0/flags/4x3/cn.svg'
);
});

it('should return the ar flag', () => {
const renderedComponent = shallow(<LocaleToggle {...props} />);
const { getFlagUrl } = renderedComponent.instance();

expect(getFlagUrl('ar')).toEqual(
'https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/3.1.0/flags/4x3/sa.svg'
);
});

it('should return the ko flag', () => {
const renderedComponent = shallow(<LocaleToggle {...props} />);
const { getFlagUrl } = renderedComponent.instance();

expect(getFlagUrl('ko')).toEqual(
'https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/3.1.0/flags/4x3/kr.svg'
);
});

it('should return the ja flag', () => {
const renderedComponent = shallow(<LocaleToggle {...props} />);
const { getFlagUrl } = renderedComponent.instance();

expect(getFlagUrl('ja')).toEqual(
'https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/3.1.0/flags/4x3/jp.svg'
);
});

it('should return the vn flag', () => {
const renderedComponent = shallow(<LocaleToggle {...props} />);
const { getFlagUrl } = renderedComponent.instance();

expect(getFlagUrl('vi')).toEqual(
'https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/3.1.0/flags/4x3/vn.svg'
);
});

it('should return the sk flag', () => {
const renderedComponent = shallow(<LocaleToggle {...props} />);
const { getFlagUrl } = renderedComponent.instance();

expect(getFlagUrl('sk')).toEqual(
'https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/3.1.0/flags/4x3/sk.svg'
);
});

it('should return the cz flag', () => {
const renderedComponent = shallow(<LocaleToggle {...props} />);
const { getFlagUrl } = renderedComponent.instance();

expect(getFlagUrl('cs')).toEqual(
'https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/3.1.0/flags/4x3/cz.svg'
);
});

it('should return the ms flag', () => {
const renderedComponent = shallow(<LocaleToggle {...props} />);
const { getFlagUrl } = renderedComponent.instance();

expect(getFlagUrl('ms')).toEqual(
'https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/3.1.0/flags/4x3/my.svg'
);
});

it('should return the se flag', () => {
const renderedComponent = shallow(<LocaleToggle {...props} />);
const { getFlagUrl } = renderedComponent.instance();

expect(getFlagUrl('sv')).toEqual(
'https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/3.1.0/flags/4x3/se.svg'
);
});

it('should return the locale flag', () => {
const renderedComponent = shallow(<LocaleToggle {...props} />);
const { getFlagUrl } = renderedComponent.instance();
const locale = 'fr';
expect(getFlagUrl(locale)).toEqual(
`https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/3.1.0/flags/4x3/${locale}.svg`
);
});
});

describe('<LocaleToggle />, toggle instance', () => {
it('should update the state when called', () => {
const renderedComponent = shallow(<LocaleToggle {...props} />);
Expand Down

0 comments on commit f0a51c4

Please sign in to comment.