"use strict";
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
Object.defineProperty(exports, "__esModule", { value: true });
const Storage_1 = require("../../Storage");
describe('Cdm.Storage.ResourceAdapter', () => {
    /**
     * Tests if the calls to CreateCorpusPath return the expected corpus path.
     */
    it('TestCreateCorpusPath', () => {
        const adapter = new Storage_1.ResourceAdapter();
        let path = adapter.createCorpusPath('Microsoft.CommonDataModel.ObjectModel.Resources/extensions/pbi.extension.cdm.json');
        expect(path)
            .toBe('/extensions/pbi.extension.cdm.json');
        path = adapter.createCorpusPath('Microsoft.CommonDataModel.ObjectModel.Resources/primitives.cdm.json');
        expect(path)
            .toBe('/primitives.cdm.json');
    });
    /**
     * Tests if the calls to CreateAdapterPath return the expected adapter path.
     */
    it('TestCreateAdapterPath', () => {
        const adapter = new Storage_1.ResourceAdapter();
        let path = adapter.createAdapterPath('/extensions/pbi.extension.cdm.json');
        expect(path)
            .toBe('Microsoft.CommonDataModel.ObjectModel.Resources/extensions/pbi.extension.cdm.json');
        path = adapter.createAdapterPath('/primitives.cdm.json');
        expect(path)
            .toBe('Microsoft.CommonDataModel.ObjectModel.Resources/primitives.cdm.json');
    });
    /**
     * Tests if the files from the resource adapter can be read correctly.
     */
    it('TestReadAsync', () => __awaiter(void 0, void 0, void 0, function* () {
        const adapter = new Storage_1.ResourceAdapter();
        expect(yield adapter.readAsync('/extensions/pbi.extension.cdm.json'))
            .not
            .toBeNull();
        expect(yield adapter.readAsync('/primitives.cdm.json'))
            .not
            .toBeNull();
    }));
});
//# sourceMappingURL=ResourceAdapter.test.js.map