File tree 2 files changed +17
-9
lines changed
tests/Feature/Http/Controllers
2 files changed +17
-9
lines changed Original file line number Diff line number Diff line change @@ -65,15 +65,18 @@ public function store()
65
65
$ validated ['team_id ' ] = auth ()->user ()->current_team_id ;
66
66
$ project = Project::create ($ validated );
67
67
68
- Chat::create ([
68
+ $ chat = Chat::create ([
69
69
'chatable_id ' => $ project ->id ,
70
70
'chatable_type ' => Project::class,
71
71
'chat_driver ' => $ chat_driver ,
72
72
'user_id ' => auth ()->user ()->id ,
73
73
'embedding_driver ' => $ embedding_driver ,
74
74
]);
75
75
76
- return redirect ()->route ('projects.show ' , $ project );
76
+ return to_route ('projects.showWithChat ' , [
77
+ 'project ' => $ project ,
78
+ 'chat ' => $ chat ,
79
+ ]);
77
80
}
78
81
79
82
public function show (Project $ project )
@@ -138,8 +141,6 @@ public function update(Project $project)
138
141
'system_prompt ' => 'required ' ,
139
142
'status ' => 'required ' ,
140
143
'content ' => 'required ' ,
141
- 'chat_driver ' => 'required ' ,
142
- 'embedding_driver ' => 'required ' ,
143
144
]);
144
145
145
146
$ project ->update ($ validated );
Original file line number Diff line number Diff line change 3
3
namespace Tests \Feature \Http \Controllers ;
4
4
5
5
use App \Domains \Projects \StatusEnum ;
6
+ use App \Models \Chat ;
6
7
use App \Models \Project ;
7
8
use App \Models \Team ;
8
9
use App \Models \User ;
@@ -96,14 +97,20 @@ public function test_show(): void
96
97
97
98
$ campaign = Project::factory ()->create ();
98
99
99
- $ this ->assertDatabaseCount ('chats ' , 0 );
100
+ Chat::factory ()->create ([
101
+ 'chatable_id ' => $ campaign ->id ,
102
+ 'chatable_type ' => Project::class,
103
+ 'chat_driver ' => DriversEnum::Claude->value ,
104
+ 'embedding_driver ' => DriversEnum::Claude->value ,
105
+ ]);
100
106
101
107
$ this ->actingAs ($ user )->get (
102
108
route ('projects.show ' , $ campaign )
103
- )->assertStatus (200 )
104
- ->assertInertia (fn (Assert $ assert ) => $ assert
105
- ->has ('project.data ' )
106
- );
109
+ )->assertStatus (302 )
110
+ ->assertRedirect (route ('projects.showWithChat ' , [
111
+ 'project ' => $ campaign ,
112
+ 'chat ' => $ campaign ->chats ->first (),
113
+ ]));
107
114
108
115
$ this ->assertDatabaseCount ('chats ' , 1 );
109
116
}
You can’t perform that action at this time.
0 commit comments