public/js/tests/search_query.spec.js in sequenceserver-3.1.0 vs public/js/tests/search_query.spec.js in sequenceserver-3.1.1

- old
+ new

@@ -8,13 +8,24 @@ let container; let inputEl; describe('SEARCH COMPONENT', () => { + let csrfMetaTag; + beforeEach(() => { + csrfMetaTag = document.createElement('meta'); + csrfMetaTag.setAttribute('name', '_csrf'); + csrfMetaTag.setAttribute('content', 'test-token'); + document.head.appendChild(csrfMetaTag); container = render(<Form onSequenceTypeChanged={() => { } } />).container; inputEl = screen.getByRole('textbox', { name: '' }); + }); + + afterEach(() => { + // Remove the CSRF meta tag after each test to clean up + document.head.removeChild(csrfMetaTag); }); test('should render the search component textarea', () => { expect(inputEl).toBeInTheDocument(); });