"use strict";

var Validator = require('./validator');
describe('Validator', function () {
  var questions = [{
    type: 'group',
    key: 'projectSummary',
    label: 'Project Summary',
    questions: [{
      type: 'input',
      key: 'project_title',
      label: 'Project Title',
      inputType: 'text',
      required: true
    }]
  }];
  it('should find form valid', function () {
    var answers = {
      projectSummary: {
        project_title: 'Test Project'
      }
    };
    expect(Validator.isFormValid(questions, answers)).toBeTruthy();
  });
  it('should find form invalid when answer is empty', function () {
    var answers = {
      projectSummary: {
        project_title: ''
      }
    };
    expect(Validator.isFormValid(questions, answers)).toBeFalsy();
  });
  it('should find form invalid when question is not answered', function () {
    var answers = {
      projectSummary: {}
    };
    expect(Validator.isFormValid(questions, answers)).toBeFalsy();
  });
});