@@ -3,6 +3,39 @@ const nock = require('nock');
33const path = require ( 'path' ) ;
44const fs = require ( 'fs' ) ;
55
6+ // Set up test helpers that were previously in setup.js
7+ global . testHelpers = {
8+ validPersonas : [ 'unemployment-benefits' , 'parks-recreation' , 'business-licensing' , 'default' ] ,
9+
10+ validateApiResponse : ( response ) => {
11+ // Handle both direct response objects and response bodies with different structures
12+ const body = response . body || response ;
13+ if ( body . message && body . message . content ) {
14+ expect ( typeof body . message . content ) . toBe ( 'string' ) ;
15+ expect ( body . message . content . length ) . toBeGreaterThan ( 0 ) ;
16+ } else if ( body . response ) {
17+ expect ( typeof body . response ) . toBe ( 'string' ) ;
18+ expect ( body . response . length ) . toBeGreaterThan ( 0 ) ;
19+ } else if ( typeof body === 'string' ) {
20+ expect ( body . length ) . toBeGreaterThan ( 0 ) ;
21+ } else {
22+ // Flexible validation for various response formats
23+ expect ( body ) . toHaveProperty ( 'message' ) ;
24+ }
25+ }
26+ } ;
27+
28+ // Set up test data
29+ global . testData = {
30+ sampleMessages : {
31+ unemploymentbenefits : 'I need help applying for unemployment benefits. What documents do I need?' ,
32+ parksrecreation : 'What are the operating hours for the community center?' ,
33+ businesslicensing : 'I need to apply for a restaurant business license. What is the process?' ,
34+ default : 'I need help with city services. Can you direct me to the right department?' ,
35+ general : [ 'What services do you provide?' , 'How can I contact customer support?' , 'What are your hours?' ]
36+ }
37+ } ;
38+
639// Import our server for testing
740const createTestApp = ( ) => {
841 const express = require ( 'express' ) ;
0 commit comments