"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 testHelper_1 = require("../testHelper");
describe('Cdm.Storage.ResourceAdapter', () => {
    const testsSubpath = 'Storage';
    /**
     * Test that with a remote adapter configured, the partition paths get properly turned to their mapped keys.
     */
    it('TestModelJsonRemoteAdapterConfig', () => __awaiter(void 0, void 0, void 0, function* () {
        const corpus = testHelper_1.testHelper.getLocalCorpus(testsSubpath, 'TestModelJsonRemoteAdapterConfig');
        const manifest = yield corpus.fetchObjectAsync('model.json');
        // Confirm that the partition URL has been mapped to 'contoso' by RemoteAdapter
        // Manifest loaded from model.json should not be null
        expect(manifest).not.toBeNull();
        // There should be only one entity loaded from model.json
        expect(manifest.entities.allItems.length).toBe(1);
        // There should be only one partition attached to the entity loaded from model.json
        expect(manifest.entities.allItems[0].dataPartitions.allItems.length).toBe(1);
        // The partition location loaded from model.json did not match
        expect(manifest.entities.allItems[0].dataPartitions.allItems[0].location).toBe('remote:/contoso/some/path/partition-data.csv');
    }));
});
//# sourceMappingURL=RemoteAdapter.test.js.map