mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-18 09:35:20 +02:00
74 lines
1.1 KiB
TypeScript
74 lines
1.1 KiB
TypeScript
import { PaginatedList, RemoteItem, getSupportsDeltaWithItems } from './file-api';
|
|
|
|
const defaultPaginatedList = (): PaginatedList => {
|
|
return {
|
|
items: [],
|
|
hasMore: false,
|
|
context: null,
|
|
};
|
|
};
|
|
|
|
const defaultItem = (): RemoteItem => {
|
|
return {
|
|
id: '',
|
|
};
|
|
};
|
|
|
|
describe('file-api', () => {
|
|
|
|
test.each([
|
|
[
|
|
{
|
|
...defaultPaginatedList(),
|
|
items: [],
|
|
},
|
|
false,
|
|
],
|
|
|
|
[
|
|
{
|
|
...defaultPaginatedList(),
|
|
items: [
|
|
{
|
|
...defaultItem(),
|
|
path: 'test',
|
|
},
|
|
],
|
|
},
|
|
false,
|
|
],
|
|
|
|
[
|
|
{
|
|
...defaultPaginatedList(),
|
|
items: [
|
|
{
|
|
...defaultItem(),
|
|
path: 'test',
|
|
jopItem: null,
|
|
},
|
|
],
|
|
},
|
|
true,
|
|
],
|
|
|
|
[
|
|
{
|
|
...defaultPaginatedList(),
|
|
items: [
|
|
{
|
|
...defaultItem(),
|
|
path: 'test',
|
|
jopItem: { something: 'abcd' },
|
|
},
|
|
],
|
|
},
|
|
true,
|
|
],
|
|
])('should tell if the sync target supports delta with items', async (deltaResponse: PaginatedList, expected: boolean) => {
|
|
const actual = getSupportsDeltaWithItems(deltaResponse);
|
|
expect(actual).toBe(expected);
|
|
});
|
|
|
|
});
|