You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-11-26 22:41:17 +02:00
Desktop, Cli, Mobile, Server: Optimise synchronisation by making delta call return whole items
This commit is contained in:
73
packages/lib/file-api.test.ts
Normal file
73
packages/lib/file-api.test.ts
Normal file
@@ -0,0 +1,73 @@
|
||||
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);
|
||||
});
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user