"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const react_1 = __importDefault(require("react"));
const react_i18next_1 = require("react-i18next");
const react_test_renderer_1 = require("react-test-renderer");
const QuestionContext_1 = require("../../src/components/context/QuestionContext");
const QuestionAutoScore_1 = __importDefault(require("../../src/components/results/internal/QuestionAutoScore"));
const i18n_1 = require("../../src/i18n");
describe('<QuestionAutoScore />', () => {
    let i18n;
    beforeAll(() => {
        i18n = (0, i18n_1.initI18n)('fi-FI');
    });
    it('renders without score', () => {
        const props = {
            score: undefined,
            maxScore: 3,
            displayNumber: '1',
            questionId: 1
        };
        expect(renderWithContext(props, []).toJSON()).toMatchSnapshot();
    });
    it('renders with score', () => {
        const props = {
            score: 1,
            maxScore: 3,
            displayNumber: '1',
            questionId: 1
        };
        expect(renderWithContext(props, []).toJSON()).toMatchSnapshot();
    });
    it('renders displayNumber number when there are more than one answer', () => {
        const props = {
            score: 1,
            maxScore: 3,
            displayNumber: '1',
            questionId: 1
        };
        expect(renderWithContext(props, [{}, {}]).toJSON()).toMatchSnapshot();
    });
    const contextProps = {
        answers: [],
        displayNumber: '1',
        hasExternalMaterial: false,
        maxAnswers: 2,
        maxScore: 2,
        level: 2,
        childQuestions: [],
        questionLabelIds: ''
    };
    function renderWithContext(props, answers) {
        return (0, react_test_renderer_1.create)(react_1.default.createElement(QuestionContext_1.QuestionContext.Provider, { value: { ...contextProps, answers } },
            react_1.default.createElement(react_i18next_1.I18nextProvider, { i18n: i18n },
                react_1.default.createElement(QuestionAutoScore_1.default, { ...props }))));
    }
});
//# sourceMappingURL=ResultsExamQuestionAutoScore.test.js.map