1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-21 09:38:01 +02:00
joplin/packages/lib/file-api.test.ts

74 lines
1.1 KiB
TypeScript
Raw Normal View History

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);
});
});