🐛 When we are creating path for the files to store them in S3 (#583)

* 🐛When we are creating path for the files to store them in S3, sometimes it's with trailing "/" and sometimes without
This commit is contained in:
Anton Shepilov
2024-07-18 16:03:29 +02:00
committed by GitHub
parent e76da87916
commit 8a2651134b
4 changed files with 257 additions and 198 deletions
@@ -0,0 +1,31 @@
import StorageService from "../../../../../../src/core/platform/services/storage/storage-service";
import { jest } from "@jest/globals";
import { TdriveServiceConfiguration } from "../../../../../../src/core/platform/framework";
describe("The StorageService", () => {
beforeEach(async () => {
});
afterEach(() => {
jest.clearAllMocks();
});
test("StorageService constructor should throw an exception for S3 storage configuration when home directory starts with trailing slash", async () => {
//when
expect(() => {
new StorageService({
configuration: {
get(name: string){
if (name === "type") return "S3";
if (name === "S3.homeDirectory") return "/my_mock_folder";
return null;
}
} as TdriveServiceConfiguration,
name: "MockStorageService",
})
}).toThrow("For S3 connector home directory MUST NOT start with '/'");
});
});