diff options
Diffstat (limited to 'spec/frontend/vue_shared/components/source_viewer/utils_spec.js')
-rw-r--r-- | spec/frontend/vue_shared/components/source_viewer/utils_spec.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/frontend/vue_shared/components/source_viewer/utils_spec.js b/spec/frontend/vue_shared/components/source_viewer/utils_spec.js index 0ac72aa9afb..a656b06068b 100644 --- a/spec/frontend/vue_shared/components/source_viewer/utils_spec.js +++ b/spec/frontend/vue_shared/components/source_viewer/utils_spec.js @@ -1,6 +1,7 @@ import { setHTMLFixture } from 'helpers/fixtures'; import { calculateBlameOffset, + shouldRender, toggleBlameClasses, } from '~/vue_shared/components/source_viewer/utils'; import { SOURCE_CODE_CONTENT_MOCK, BLAME_DATA_MOCK } from './mock_data'; @@ -21,6 +22,19 @@ describe('SourceViewer utils', () => { }); }); + describe('shouldRender', () => { + const commit = { sha: 'abc' }; + const identicalSha = [{ commit }, { commit }]; + + it.each` + data | index | result + ${identicalSha} | ${0} | ${true} + ${identicalSha} | ${1} | ${false} + `('returns $result', ({ data, index, result }) => { + expect(shouldRender(data, index)).toBe(result); + }); + }); + describe('toggleBlameClasses', () => { it('adds classes', () => { toggleBlameClasses(BLAME_DATA_MOCK, true); |