diff --git a/test/e2e.spec.ts b/test/e2e.spec.ts index e3aa22a1..56b77ba1 100644 --- a/test/e2e.spec.ts +++ b/test/e2e.spec.ts @@ -120,8 +120,22 @@ export class E2EConnectorSpec { const emptyDirPath = join(__dirname, 'emptyDir'); if(!existsSync(emptyDirPath)) mkdirSync(emptyDirPath); - return indexSamples(httpClient, {to: 'http://localhost', samples: emptyDirPath}) + await indexSamples(httpClient, {to: 'http://localhost', samples: emptyDirPath}) .should.be.rejectedWith('Could not index samples. None were retrived from the file system.'); + rmdirSync(emptyDirPath); + } + + @test + async indexShouldFailDirectoryWithoutJsonData() { + const somewhatFilledDirPath = join(__dirname, 'somewhatFilledDir'); + if(!existsSync(somewhatFilledDirPath)) + mkdirSync(somewhatFilledDirPath); + const nonJsonFile = join (somewhatFilledDirPath, 'nonjson.txt'); + createFileSync(nonJsonFile); + await indexSamples(httpClient, {to: 'http://localhost', samples: somewhatFilledDirPath}) + .should.be.rejectedWith('Could not index samples. None were retrived from the file system.'); + unlinkSync(nonJsonFile); + rmdirSync(somewhatFilledDirPath); } }