UNPKG

@itwin/object-storage-tests-backend

Version:

Tests for generic storage packages

34 lines 1.53 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.TestRemoteDirectoryManager = void 0; /*--------------------------------------------------------------------------------------------- * Copyright (c) Bentley Systems, Incorporated. All rights reserved. * See LICENSE.md in the project root for license terms and full copyright notice. *--------------------------------------------------------------------------------------------*/ const crypto_1 = require("crypto"); const Config_1 = require("../Config"); const TestRemoteDirectory_1 = require("./TestRemoteDirectory"); const { serverStorage } = Config_1.config; class TestRemoteDirectoryManager { constructor() { this._createdDirectories = []; } async createNew() { const newDirectory = { baseDirectory: `integration-tests-${crypto_1.randomUUID()}`, }; this.addForDelete(newDirectory); await serverStorage.createBaseDirectory(newDirectory); return new TestRemoteDirectory_1.TestRemoteDirectory(newDirectory); } addForDelete(directory) { this._createdDirectories.push(directory); } async purgeCreatedDirectories() { for (const directoryToDelete of this._createdDirectories) await serverStorage.deleteBaseDirectory(directoryToDelete); this._createdDirectories = []; } } exports.TestRemoteDirectoryManager = TestRemoteDirectoryManager; //# sourceMappingURL=TestRemoteDirectoryManager.js.map