From 6fb58f37903b5d2c2265b91de4508767b5396d32 Mon Sep 17 00:00:00 2001 From: Michel Jonathan Schmitz Date: Wed, 19 Jun 2019 16:14:51 +0200 Subject: [PATCH] test: add test for full coverage testing --- test/e2e.spec.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) 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); } }