Closed dumyan closed 7 years ago
@dumyan One other thing - I suppose we need much more tests for path resolutions. Could you write a few additional tests (for resource and datapackage if needed) with comprehensive list of combinations (basePath/path) to cover all edge cases? It could look like this for example:
it('resource source/type correctly works with base path', async () => {
const paths = [
{base: 'folder1', path: 'data/data.csv', source: 'folder1/data/data.csv', type: 'local'},
// ... like 10 more)
]
paths.forEach({base, path, source, type} => {
const resource = new Resource({path}, base)
assert(resource.source === source)
assert(resource.type === type)
})
})
it('resource source/type correctly works without base path', async () => {
The same technique could be used for other tests to ensure Resource.source/type
works correctly on all possible input data.
Resolves #41 by adding
basePath
for remote datapackages and after that usingurl.resolve
inResources
class to point to the relative resource.