mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-21 17:12:43 +00:00
test: create the empty test directory via code
This commit is contained in:
@@ -24,7 +24,9 @@ import {
|
|||||||
import * as chai from 'chai';
|
import * as chai from 'chai';
|
||||||
import * as chaiAsPromised from 'chai-as-promised';
|
import * as chaiAsPromised from 'chai-as-promised';
|
||||||
import * as chaiSpies from 'chai-spies';
|
import * as chaiSpies from 'chai-spies';
|
||||||
|
import {existsSync, mkdirSync} from 'fs';
|
||||||
import {suite, test} from 'mocha-typescript';
|
import {suite, test} from 'mocha-typescript';
|
||||||
|
import {join} from 'path';
|
||||||
import {getItemsFromSamples, indexSamples} from '../src/e2e';
|
import {getItemsFromSamples, indexSamples} from '../src/e2e';
|
||||||
import {ApiError} from '../src/errors';
|
import {ApiError} from '../src/errors';
|
||||||
import {HttpClient, RequestOptions, Response} from '../src/httpClient';
|
import {HttpClient, RequestOptions, Response} from '../src/httpClient';
|
||||||
@@ -114,7 +116,10 @@ export class E2EConnectorSpec {
|
|||||||
|
|
||||||
@test
|
@test
|
||||||
async indexShouldFailDirectoryWithoutData() {
|
async indexShouldFailDirectoryWithoutData() {
|
||||||
return indexSamples(httpClient, {to: 'http://localhost', samples: './test/emptyDir/'})
|
const emptyDirPath = join(__dirname, 'emptyDir');
|
||||||
|
if(!existsSync(emptyDirPath))
|
||||||
|
mkdirSync(emptyDirPath);
|
||||||
|
return indexSamples(httpClient, {to: 'http://localhost', samples: emptyDirPath})
|
||||||
.should.be.rejectedWith('Could not index samples. None were retrived from the file system.');
|
.should.be.rejectedWith('Could not index samples. None were retrived from the file system.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
4
test/emptyDir/.gitignore
vendored
4
test/emptyDir/.gitignore
vendored
@@ -1,4 +0,0 @@
|
|||||||
# Ignore everything in this directory
|
|
||||||
*
|
|
||||||
# Except this file
|
|
||||||
!.gitignore
|
|
||||||
Reference in New Issue
Block a user