"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 internal_1 = require("../../../internal");
const testHelper_1 = require("../../testHelper");
const ResolutionTestUtils_1 = require("./ResolutionTestUtils");
/**
 * Tests to verify if resolution of trait groups performs as expected.
 */
describe('Cdm/Resolution/EntityResolutionTraitGroupTest', () => {
    const testsSubpath = 'Cdm/Resolution/EntityResolutionTest';
    /**
     * Verify success case and make sure the entities are resolved
     */
    it('TestResolvedTraitGroupE2E', () => __awaiter(void 0, void 0, void 0, function* () {
        yield ResolutionTestUtils_1.resolutionTestUtils.resolveSaveDebuggingFileAndAssert(testsSubpath, 'TestResolvedTraitGroup', 'E2EResolution');
    }));
    /**
     * Verify that the traits are assigned appropriately.
     * AND no errors or warnings are thrown.
     * If the optional traitgroups are not ignored, then this will fail.
     */
    it('TestTraitsFromTraitGroup', () => __awaiter(void 0, void 0, void 0, function* () {
        const cdmCorpus = testHelper_1.testHelper.getLocalCorpus(testsSubpath, 'TestResolvedTraitGroup');
        cdmCorpus.setEventCallback((statusLevel, message) => {
            if (message.indexOf('Resolution guidance is being deprecated in favor of Projections.') === -1) {
                throw new Error(`Received ${statusLevel} message: ${message}`);
            }
        }, internal_1.cdmStatusLevel.warning);
        const ent = yield cdmCorpus.fetchObjectAsync('local:/E2EResolution/Contact.cdm.json/Contact');
        yield ent.createResolvedEntityAsync('Contact_');
    }));
});
//# sourceMappingURL=EntityResolutionTraitGroupTest.test.js.map