fixign tests.

This commit is contained in:
Jason Kulatunga 2022-10-29 13:17:05 -07:00
parent 8d7ddddd78
commit b433cf24f2
2 changed files with 41 additions and 38 deletions

View File

@ -98,42 +98,4 @@ describe('PouchdbRepository', () => {
expect((sourcesWrapped.rows[0] as Source).patient).toEqual('patient1');
});
})
describe('GetEndpointAbsolutePath', () => {
describe('with no subpath and no /web/', () => {
it('should return absolute path', async () => {
let currentUrl = new URL("http://www.example.com/")
const absoluteUrl = repository.GetEndpointAbsolutePath(currentUrl, '/database')
expect(absoluteUrl).toEqual('http://www.example.com/database');
});
})
describe('with subpath and no /web/', () => {
it('should return absolute path', async () => {
let currentUrl = new URL("http://www.example.com/hello/world")
const absoluteUrl = repository.GetEndpointAbsolutePath(currentUrl, '/database')
expect(absoluteUrl).toEqual('http://www.example.com/database');
});
})
describe('with no subpath and /web/', () => {
it('should return absolute path', async () => {
let currentUrl = new URL("http://www.example.com/web/world")
const absoluteUrl = repository.GetEndpointAbsolutePath(currentUrl, '/database')
expect(absoluteUrl).toEqual('http://www.example.com/database');
});
})
describe('with subpath and /web/', () => {
it('should return absolute path', async () => {
let currentUrl = new URL("http://www.example.com/fasten/web/hello/world")
const absoluteUrl = repository.GetEndpointAbsolutePath(currentUrl, '/database')
expect(absoluteUrl).toEqual('http://www.example.com/fasten/database');
});
})
})
});

View File

@ -0,0 +1,41 @@
import {GetEndpointAbsolutePath} from './endpoint_absolute_path';
describe('PouchdbRepository', () => {
describe('GetEndpointAbsolutePath', () => {
describe('with no subpath and no /web/', () => {
it('should return absolute path', async () => {
let currentUrl = new URL("http://www.example.com/")
const absoluteUrl = GetEndpointAbsolutePath(currentUrl, '/database')
expect(absoluteUrl).toEqual('http://www.example.com/database');
});
})
describe('with subpath and no /web/', () => {
it('should return absolute path', async () => {
let currentUrl = new URL("http://www.example.com/hello/world")
const absoluteUrl = GetEndpointAbsolutePath(currentUrl, '/database')
expect(absoluteUrl).toEqual('http://www.example.com/database');
});
})
describe('with no subpath and /web/', () => {
it('should return absolute path', async () => {
let currentUrl = new URL("http://www.example.com/web/world")
const absoluteUrl = GetEndpointAbsolutePath(currentUrl, '/database')
expect(absoluteUrl).toEqual('http://www.example.com/database');
});
})
describe('with subpath and /web/', () => {
it('should return absolute path', async () => {
let currentUrl = new URL("http://www.example.com/fasten/web/hello/world")
const absoluteUrl = GetEndpointAbsolutePath(currentUrl, '/database')
expect(absoluteUrl).toEqual('http://www.example.com/fasten/database');
});
})
})
});