"use strict";

var FlexibleQuestionnaire = require('./flexible-questionnaire');
var data = require('../../helper/flexible-questionnaire/fq-helper-test-data');
describe('validateUA', function () {
  var groupQuestion = {
    key: 'project_overview',
    label: 'Project Overview',
    questions: [data.inputQuestion, data.textAreaQuestion],
    required: true,
    type: 'group'
  };
  var fq = new FlexibleQuestionnaire();
  var questions = [groupQuestion];
  it('should validate the form successful when required questions are answered', function () {
    var answers = {
      project_overview: {
        project_title: 'test',
        project_summary: 'something'
      }
    };
    expect(fq.isValid(questions, answers)).toBeTruthy();
  });
  it('should fail to validate form successful when required questions are not answered', function () {
    var answers = {
      project_overview: {
        project_title: 'test',
        project_summary: ''
      }
    };
    expect(fq.isValid(questions, answers)).toBeFalsy();
  });
});