You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-11-23 22:36:32 +02:00
All: Fixes 12810: Ensure the sync shows an error when the server is down, when using a local WebDAV server (#13301)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { PaginatedList, RemoteItem, getSupportsDeltaWithItems } from './file-api';
|
||||
import { PaginatedList, RemoteItem, getSupportsDeltaWithItems, isLocalServer } from './file-api';
|
||||
|
||||
const defaultPaginatedList = (): PaginatedList => {
|
||||
return {
|
||||
@@ -70,4 +70,28 @@ describe('file-api', () => {
|
||||
expect(actual).toBe(expected);
|
||||
});
|
||||
|
||||
it.each([
|
||||
'http://localhost',
|
||||
'http://localhost/',
|
||||
'https://localhost:8080',
|
||||
'http://127.0.0.1',
|
||||
'https://127.100.50.25:3000/test',
|
||||
'http://[::1]',
|
||||
'http://localhost/api/v1',
|
||||
])('should detect a local server url', (url: string) => {
|
||||
const result = isLocalServer(url);
|
||||
expect(result).toBe(true);
|
||||
});
|
||||
|
||||
it.each([
|
||||
'http://localhostXYZ',
|
||||
'http://127.0.0.1foobar',
|
||||
'http://192.168.1.1',
|
||||
'http://example.com',
|
||||
'https://my-localhost.com',
|
||||
])('should detect a non local server url', (url: string) => {
|
||||
const result = isLocalServer(url);
|
||||
expect(result).toBe(false);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user