From f7ef12fd477b29a4749f902c93c86cae77137466 Mon Sep 17 00:00:00 2001 From: vashjs <86330150+vashjs@users.noreply.github.com> Date: Fri, 9 Feb 2024 00:20:55 +0100 Subject: [PATCH] UIBULKED-384 Change delimiters to split string (#472) --- .../ElectronicAccessTable/ElectronicAccessTable.js | 9 ++------- .../ElectronicAccessTable/ElectronicAccessTable.test.js | 4 ++-- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/components/BulkEditList/BulkEditListResult/Preview/ElectronicAccessTable/ElectronicAccessTable.js b/src/components/BulkEditList/BulkEditListResult/Preview/ElectronicAccessTable/ElectronicAccessTable.js index 494ff537..c3763c1a 100644 --- a/src/components/BulkEditList/BulkEditListResult/Preview/ElectronicAccessTable/ElectronicAccessTable.js +++ b/src/components/BulkEditList/BulkEditListResult/Preview/ElectronicAccessTable/ElectronicAccessTable.js @@ -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 ( diff --git a/src/components/BulkEditList/BulkEditListResult/Preview/ElectronicAccessTable/ElectronicAccessTable.test.js b/src/components/BulkEditList/BulkEditListResult/Preview/ElectronicAccessTable/ElectronicAccessTable.test.js index 002a8833..6b381a4f 100644 --- a/src/components/BulkEditList/BulkEditListResult/Preview/ElectronicAccessTable/ElectronicAccessTable.test.js +++ b/src/components/BulkEditList/BulkEditListResult/Preview/ElectronicAccessTable/ElectronicAccessTable.test.js @@ -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(); @@ -21,7 +21,7 @@ describe('ElectronicAccessTable', () => { it('renders table body rows correctly', () => { const { getByText } = render(); - const tableBodyRows = testValue.split('|').map(row => row.split(';')); + const tableBodyRows = testValue.split('\u001f|').map(row => row.split('\u001f;')); tableBodyRows.forEach(row => { row.forEach(cell => {