Skip to content

Commit

Permalink
unit test fix
Browse files Browse the repository at this point in the history
  • Loading branch information
hassanad94 committed Nov 21, 2023
1 parent dbd61b6 commit cf4e530
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export const PickerHelper = ({
<Link
data-test="current-content"
variant="body2"
onClick={() => handleJumpToCurrentPath(contextPath || '')}
onClick={() => handleJumpToCurrentPath(contextPath)}

Check warning on line 59 in packages/sn-pickers-react/src/components/picker/picker-helper.tsx

View check run for this annotation

Codecov / codecov/patch

packages/sn-pickers-react/src/components/picker/picker-helper.tsx#L59

Added line #L59 was not covered by tests
className={styles}>
{currentContentText || 'Current Content'}
</Link>
Expand Down
42 changes: 0 additions & 42 deletions packages/sn-pickers-react/tests/picker.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -417,48 +417,6 @@ describe('Picker component', () => {
wrapper.update()
})

it('should handle distinct SelectionRoots', async () => {
const loadCollection = () => ({
d: {
results: [
{
Id: 10,
Type: 'Folder',
Path: '/Root/Content',
Name: 'SampleWorkspace',
DisplayName: 'Sample Workspace',
},
],
},
})
const load = jest.fn()
const onTreeNavigation = jest.fn()

let wrapper: any
await act(async () => {
wrapper = mount(
<Picker
currentPath="/Root/Content"
repository={{ loadCollection, load } as any}
selectionRoots={['/Root/Content', '/Root/IMS/Public', '/Root/Content/TestFolder']}
onTreeNavigation={onTreeNavigation}
/>,
)
})

wrapper.update()

await act(async () => wrapper.update().find(ListItem).at(0).simulate('dblclick'))

expect(onTreeNavigation).toHaveBeenCalledWith('!VirtualRoot!')

expect(load).toHaveBeenCalledWith({ idOrPath: '/Root/Content', oDataOptions: undefined })
expect(load).toHaveBeenCalledWith({
idOrPath: '/Root/IMS/Public',
oDataOptions: undefined,
})
})

it('should render helper Current Conten based on SelectionRoot', async () => {
let helperItems = { Id: 1, Name: 'Item1', DisplayName: 'Display Item1', Path: '/Root/Content/EN/Blog/Posts' }

Expand Down

0 comments on commit cf4e530

Please sign in to comment.