Skip to content

Commit

Permalink
UIBULKED-384 Change delimiters to split string (#472)
Browse files Browse the repository at this point in the history
  • Loading branch information
vashjs authored Feb 8, 2024
1 parent 8d07d85 commit f7ef12f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,8 @@ import { ELECTRONIC_ACCESS_HEAD_TITLES } from '../../../../PermissionsModal/cons
import css from './ElectronicAcess.css';

export const ElectronicAccessTable = ({ value }) => {
const tableBodyRows = value?.split('|')
.map(row => {
const cells = row.split(';');
const [uri, linkText, materialsSpecified, publicNote, relationship] = cells;

return [relationship, uri, linkText, materialsSpecified, publicNote];
});
const tableBodyRows = value?.split('\u001f|')
.map(row => row.split('\u001f;'));

return (
<table className={css.ElectronicAccess}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import '@testing-library/jest-dom/extend-expect';
import { ElectronicAccessTable } from './ElectronicAccessTable';


const testValue = 'https://search.proquest.com/publication/1396348;test;1.2012 -;via ProQuest, the last 12 months are not available due to an embargo;Resource';
const testValue = 'https://search.proquest.com/publication/1396348\u001f;test\u001f;1.2012 -\u001f;via ProQuest, the last 12 months are not available due to an embargo\u001f;Resource';
describe('ElectronicAccessTable', () => {
it('renders table headers correctly', () => {
const { getByText } = render(<ElectronicAccessTable value={testValue} />);
Expand All @@ -21,7 +21,7 @@ describe('ElectronicAccessTable', () => {

it('renders table body rows correctly', () => {
const { getByText } = render(<ElectronicAccessTable value={testValue} />);
const tableBodyRows = testValue.split('|').map(row => row.split(';'));
const tableBodyRows = testValue.split('\u001f|').map(row => row.split('\u001f;'));

tableBodyRows.forEach(row => {
row.forEach(cell => {
Expand Down

0 comments on commit f7ef12f

Please sign in to comment.