mirror of
https://github.com/HSLdevcom/digitransit-ui
synced 2025-07-05 16:30:37 +02:00
62 lines
1.8 KiB
JavaScript
62 lines
1.8 KiB
JavaScript
import React from 'react';
|
|
|
|
import { shallowWithIntl } from '../helpers/mock-intl-enzyme';
|
|
import IconWithBigCaution from '../../../app/component/IconWithBigCaution';
|
|
import IconWithIcon from '../../../app/component/IconWithIcon';
|
|
import RouteNumber from '../../../app/component/RouteNumber';
|
|
import { mockContext } from '../helpers/mock-context';
|
|
|
|
describe('<RouteNumber />', () => {
|
|
it('should use an icon based on the mode', () => {
|
|
const props = {
|
|
mode: 'CITYBIKE',
|
|
};
|
|
const wrapper = shallowWithIntl(<RouteNumber {...props} />, {
|
|
context: mockContext,
|
|
});
|
|
expect(wrapper.find(IconWithIcon).prop('img')).to.equal(
|
|
'icon-icon_citybike',
|
|
);
|
|
});
|
|
|
|
it('should use the given icon', () => {
|
|
const props = {
|
|
icon: 'icon-icon_scooter',
|
|
mode: 'CITYBIKE',
|
|
};
|
|
const wrapper = shallowWithIntl(<RouteNumber {...props} />, {
|
|
context: mockContext,
|
|
});
|
|
expect(wrapper.find(IconWithIcon).prop('img')).to.equal(
|
|
'icon-icon_scooter',
|
|
);
|
|
});
|
|
|
|
it('should use the given icon when there is a disruption', () => {
|
|
const props = {
|
|
hasDisruption: true,
|
|
icon: 'icon-icon_scooter',
|
|
mode: 'CITYBIKE',
|
|
};
|
|
const wrapper = shallowWithIntl(<RouteNumber {...props} />, {
|
|
context: mockContext,
|
|
});
|
|
expect(wrapper.find(IconWithBigCaution).prop('img')).to.equal(
|
|
'icon-icon_scooter',
|
|
);
|
|
});
|
|
|
|
it('should use the given icon when there is a call agency', () => {
|
|
const props = {
|
|
icon: 'icon-icon_scooter',
|
|
isCallAgency: true,
|
|
mode: 'CITYBIKE',
|
|
};
|
|
const wrapper = shallowWithIntl(<RouteNumber {...props} />, {
|
|
context: mockContext,
|
|
});
|
|
expect(wrapper.find(IconWithIcon).prop('img')).to.equal(
|
|
'icon-icon_scooter',
|
|
);
|
|
});
|
|
});
|