diff --git a/frontend/libs/studio-components/.eslintrc.js b/frontend/libs/studio-components/.eslintrc.js index ba3eb447227..95317e6a918 100644 --- a/frontend/libs/studio-components/.eslintrc.js +++ b/frontend/libs/studio-components/.eslintrc.js @@ -34,6 +34,8 @@ module.exports = { }, }, ], - extends: ['plugin:storybook/recommended'], + settings: { + 'testing-library/custom-renders': ['rowsToRender'], + }, }; diff --git a/frontend/libs/studio-components/src/components/StudioTableRemotePagination/utils.test.tsx b/frontend/libs/studio-components/src/components/StudioTableRemotePagination/utils.test.tsx index 730c9e196f2..3bd2712999e 100644 --- a/frontend/libs/studio-components/src/components/StudioTableRemotePagination/utils.test.tsx +++ b/frontend/libs/studio-components/src/components/StudioTableRemotePagination/utils.test.tsx @@ -12,7 +12,6 @@ describe('getRowsToRender', () => { it('should return all rows when pageSize is 0', () => { const currentPage = 1; const pageSize = 0; - // eslint-disable-next-line testing-library/render-result-naming-convention const rowsToRender = getRowsToRender(currentPage, pageSize, rows); expect(rowsToRender).toEqual(rows); }); @@ -20,8 +19,8 @@ describe('getRowsToRender', () => { it('should return the correct rows for the first page', () => { const currentPage = 1; const pageSize = 2; - // eslint-disable-next-line testing-library/render-result-naming-convention const rowsToRender = getRowsToRender(currentPage, pageSize, rows); + expect(rowsToRender).toEqual([ { id: 1, name: 'Row 1' }, { id: 2, name: 'Row 2' }, @@ -31,24 +30,24 @@ describe('getRowsToRender', () => { it('should return the correct rows for the last page', () => { const currentPage = 3; const pageSize = 2; - // eslint-disable-next-line testing-library/render-result-naming-convention const rowsToRender = getRowsToRender(currentPage, pageSize, rows); + expect(rowsToRender).toEqual([{ id: 5, name: 'Row 5' }]); }); it('should return an empty array when currentPage is out of range', () => { const currentPage = 4; const pageSize = 2; - // eslint-disable-next-line testing-library/render-result-naming-convention const rowsToRender = getRowsToRender(currentPage, pageSize, rows); + expect(rowsToRender).toEqual([]); }); it('should return an empty array when rows is an empty array', () => { const currentPage = 1; const pageSize = 2; - // eslint-disable-next-line testing-library/render-result-naming-convention const rowsToRender = getRowsToRender(currentPage, pageSize, []); + expect(rowsToRender).toEqual([]); }); });