<commit_before>package org.chai.kevin.survey

import org.chai.kevin.IntegrationTests;
import org.chai.kevin.data.Type;

class QuestionControllerSpec extends SurveyIntegrationTests {

	def questionController
	
	def "test ajax data"() {
		setup:
		def period = newPeriod()
		def survey = newSurvey(period)
		def objective = newSurveyObjective(survey, 1, [])
		def section = newSurveySection(objective, 1, [])
		def question = newSimpleQuestion(section, 1, [])
		def dataElement = newDataElement(j(['en':'element']), CODE(1), Type.TYPE_NUMBER())
		def element = newSurveyElement(question, dataElement)
		questionController = new QuestionController()
		
		when:
		questionController.params.surveyId = survey.id
		questionController.params.term = 'ele'
		questionController.getAjaxData()
		
		then:
		questionController.responseAsString.contains('element')
		
	}
	
}<commit_msg>fixed tests<commit_after>package org.chai.kevin.survey

import org.chai.kevin.IntegrationTests;
import org.chai.kevin.data.Type;

class QuestionControllerSpec extends SurveyIntegrationTests {

	def questionController
	
	def "test ajax data"() {
		setup:
		def period = newPeriod()
		def survey = newSurvey(period)
		def objective = newSurveyObjective(survey, 1, [])
		def section = newSurveySection(objective, 1, [])
		def question = newSimpleQuestion(section, 1, [])
		def dataElement = newDataElement(j(['en':'element']), CODE(1), Type.TYPE_NUMBER())
		def element = newSurveyElement(question, dataElement)
		questionController = new QuestionController()
		
		when:
		questionController.params.surveyId = survey.id
		questionController.params.term = 'ele'
		questionController.getAjaxData()
		
		then:
		questionController.response.contentAsString.contains('element')
		
	}
	
}
{'fraction_non_alphanumeric': 0.1113013698630137, 'fraction_numerical': 0.0045662100456621, 'mean_word_length': 5.238434163701068, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5712580', 'n_tokens_mistral': 596, 'n_tokens_neox': 528, 'n_words': 111}