feat: Add DataAccessorBasedStore integration

This commit is contained in:
Joachim Van Herwegen
2020-09-30 12:07:31 +02:00
parent 9a857b7581
commit 9b26bbef2d
8 changed files with 218 additions and 45 deletions

View File

@@ -108,7 +108,8 @@ export class FileTestHelper {
return response;
}
public async createFile(fileLocation: string, slug: string, mayFail = false): Promise<MockResponse<any>> {
public async createFile(fileLocation: string, slug: string, contentType: string, mayFail = false):
Promise<MockResponse<any>> {
const fileData = await fs.readFile(
join(__dirname, fileLocation),
);
@@ -116,7 +117,7 @@ export class FileTestHelper {
const response: MockResponse<any> = await this.callWithFile(
this.baseUrl,
'POST',
{ 'content-type': 'application/octet-stream',
{ 'content-type': contentType,
slug,
'transfer-encoding': 'chunked' },
fileData,
@@ -129,7 +130,8 @@ export class FileTestHelper {
return response;
}
public async overwriteFile(fileLocation: string, requestUrl: string): Promise<MockResponse<any>> {
public async overwriteFile(fileLocation: string, requestUrl: string, contentType: string):
Promise<MockResponse<any>> {
const fileData = await fs.readFile(
join(__dirname, fileLocation),
);
@@ -139,7 +141,7 @@ export class FileTestHelper {
const response: MockResponse<any> = await this.callWithFile(
putUrl,
'PUT',
{ 'content-type': 'application/octet-stream', 'transfer-encoding': 'chunked' },
{ 'content-type': contentType, 'transfer-encoding': 'chunked' },
fileData,
);
expect(response.statusCode).toBe(200);