blob: 2ac80d2937d3a8f5cef17c264e1795dfeaab9b24 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
import mockAxios from '../__mocks__/axios'
import { generateOcsUrl } from '@nextcloud/router'
import { shareFile } from './filesSharingServices'
describe('filesSharingServices', () => {
afterEach(() => {
// cleaning up the mess left behind the previous test
mockAxios.reset()
})
test('shareFile calls the sharing API endpoint', () => {
shareFile('path/to/file', 'XXTOKENXX', 'the-reference-id')
expect(mockAxios.post).toHaveBeenCalledWith(
generateOcsUrl('apps/files_sharing/api/v1/shares'),
{
shareType: 10,
shareWith: 'XXTOKENXX',
path: 'path/to/file',
referenceId: 'the-reference-id',
}
)
})
})
|