"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var CmatchVisibility_1 = require("../../src/client/CmatchVisibility");
var chai_1 = require("chai");
var CommonResources_1 = require("./CommonResources");
var sinon = require('sinon');
describe('CmatchVisibility', function () {
    describe('_getBlueprints', function () {
        [
            {
                description: 'handles undefined classifications',
                classifications: {},
                input: [
                    {
                        name: 'shown_field',
                        cname: '--vis-shown-field',
                    },
                    {
                        name: 'hidden_field',
                        cname: '--vis-hidden-field',
                    },
                ],
                expected: [
                    {
                        name: 'shown_field',
                        cname: '--vis-shown-field',
                        show: [],
                        hide: [],
                    },
                    {
                        name: 'hidden_field',
                        cname: '--vis-hidden-field',
                        show: [],
                        hide: [],
                    },
                ],
            },
            {
                description: 'handles scalar classifications',
                classifications: {
                    '--vis-shown-field': { indexes: 1 },
                    '--vis-hidden-field': { indexes: 0 },
                },
                input: [
                    {
                        name: 'shown_field',
                        cname: '--vis-shown-field',
                    },
                    {
                        name: 'hidden_field',
                        cname: '--vis-hidden-field',
                    },
                ],
                expected: [
                    {
                        name: 'shown_field',
                        cname: '--vis-shown-field',
                        show: [0],
                        hide: [],
                    },
                    {
                        name: 'hidden_field',
                        cname: '--vis-hidden-field',
                        show: [],
                        hide: [0],
                    },
                ],
            },
            {
                description: 'handles vector classifications',
                classifications: {
                    '--vis-shown-field': { indexes: [1] },
                    '--vis-hidden-field': { indexes: [0] },
                },
                input: [
                    {
                        name: 'shown_field',
                        cname: '--vis-shown-field',
                    },
                    {
                        name: 'hidden_field',
                        cname: '--vis-hidden-field',
                    },
                ],
                expected: [
                    {
                        name: 'shown_field',
                        cname: '--vis-shown-field',
                        show: [0],
                        hide: [],
                    },
                    {
                        name: 'hidden_field',
                        cname: '--vis-hidden-field',
                        show: [],
                        hide: [0],
                    },
                ],
            },
            {
                description: 'handles indexes for multi-length vectors',
                classifications: {
                    '--vis-shown-field': { indexes: [1, 1] },
                    '--vis-partially-shown-field': { indexes: [1, 0] },
                    '--vis-hidden-field': { indexes: [0, 0] },
                },
                input: [
                    {
                        name: 'shown_field',
                        cname: '--vis-shown-field',
                    },
                    {
                        name: 'partially_shown_field',
                        cname: '--vis-partially-shown-field',
                    },
                    {
                        name: 'hidden_field',
                        cname: '--vis-hidden-field',
                    },
                ],
                expected: [
                    {
                        name: 'shown_field',
                        cname: '--vis-shown-field',
                        show: [0, 1],
                        hide: [],
                    },
                    {
                        name: 'partially_shown_field',
                        cname: '--vis-partially-shown-field',
                        show: [0],
                        hide: [1],
                    },
                    {
                        name: 'hidden_field',
                        cname: '--vis-hidden-field',
                        show: [],
                        hide: [0, 1],
                    },
                ],
            },
            {
                description: 'handles indexes for matrices',
                classifications: {
                    '--vis-shown-field': {
                        indexes: [
                            [1, 1],
                            [1, 1],
                        ],
                    },
                    '--vis-partially-shown-field': {
                        indexes: [
                            [1, 0],
                            [0, 1],
                        ],
                    },
                    '--vis-hidden-field': {
                        indexes: [
                            [0, 0],
                            [0, 0],
                        ],
                    },
                },
                input: [
                    {
                        name: 'shown_field',
                        cname: '--vis-shown-field',
                    },
                    {
                        name: 'partially_shown_field',
                        cname: '--vis-partially-shown-field',
                    },
                    {
                        name: 'hidden_field',
                        cname: '--vis-hidden-field',
                    },
                ],
                expected: [
                    {
                        name: 'shown_field',
                        cname: '--vis-shown-field',
                        show: [0, 1],
                        hide: [],
                    },
                    {
                        name: 'partially_shown_field',
                        cname: '--vis-partially-shown-field',
                        show: [0, 1],
                        hide: [],
                    },
                    {
                        name: 'hidden_field',
                        cname: '--vis-hidden-field',
                        show: [],
                        hide: [0, 1],
                    },
                ],
            },
        ].forEach(function (input) {
            it(input.description, function () {
                var stubs = {
                    getLastClassify: function () {
                        return input.classifications;
                    },
                };
                var sut = new CmatchVisibility_1.CmatchVisibility(getClient(null, stubs));
                var actual = sut.getBlueprints(input.input);
                chai_1.expect(actual).to.deep.equal(input.expected);
            });
        });
    });
});
function getClient(step, stubs) {
    if (step === void 0) { step = null; }
    var quote = CommonResources_1.createStubClientQuote();
    var ui = CommonResources_1.createStubUi(step);
    if (stubs.getLastClassify) {
        sinon.stub(quote, 'getLastClassify').callsFake(stubs.getLastClassify);
    }
    return CommonResources_1.createStubClient(quote, ui);
}
//# sourceMappingURL=data:application/json;base64, 