@@ -91,8 +91,8 @@ defmodule MastaniServer.Test.Mutation.CMSTest do
91
91
92
92
describe "[mutation cms community]" do
93
93
@ create_community_query """
94
- mutation($title: String!, $desc: String!) {
95
- createCommunity(title: $title, desc: $desc) {
94
+ mutation($title: String!, $desc: String!, $logo: String!, $raw: String!, $category: String! ) {
95
+ createCommunity(title: $title, desc: $desc, logo: $logo, raw: $raw, category: $category ) {
96
96
id
97
97
title
98
98
desc
@@ -122,13 +122,17 @@ defmodule MastaniServer.Test.Mutation.CMSTest do
122
122
assert rule_conn |> mutation_get_error? ( @ create_community_query , variables )
123
123
end
124
124
125
+ @ tag :wip
125
126
test "creator of community should be add to userContributes and communityContributes" do
126
127
variables = mock_attrs ( :community )
127
128
rule_conn = simu_conn ( :user , cms: % { "community.create" => true } )
128
129
130
+ IO . inspect ( variables , label: "hello variables" )
131
+
129
132
created_community =
130
133
rule_conn |> mutation_result ( @ create_community_query , variables , "createCommunity" )
131
134
135
+ IO . inspect ( created_community , label: "hello" )
132
136
author = created_community [ "author" ]
133
137
134
138
{ :ok , found_community } = CMS.Community |> ORM . find ( created_community [ "id" ] )
@@ -189,15 +193,16 @@ defmodule MastaniServer.Test.Mutation.CMSTest do
189
193
190
194
describe "[mutation cms thread]" do
191
195
@ query """
192
- mutation($title: String!){
193
- createThread(title: $title) {
196
+ mutation($title: String!, $raw: String! ){
197
+ createThread(title: $title, raw: $raw ) {
194
198
title
195
199
}
196
200
}
197
201
"""
198
202
test "auth user can create thread" , ~m( user) a do
199
203
title = "psot"
200
- variables = ~m( title) a
204
+ raw = title
205
+ variables = ~m( title raw) a
201
206
202
207
passport_rules = % { "thread.create" => true }
203
208
rule_conn = simu_conn ( :user , user , cms: passport_rules )
@@ -209,7 +214,8 @@ defmodule MastaniServer.Test.Mutation.CMSTest do
209
214
210
215
test "unauth user create thread fails" , ~m( user_conn guest_conn) a do
211
216
title = "psot"
212
- variables = ~m( title) a
217
+ raw = title
218
+ variables = ~m( title raw) a
213
219
rule_conn = simu_conn ( :user , cms: % { "what.ever" => true } )
214
220
215
221
assert user_conn |> mutation_get_error? ( @ query , variables )
@@ -229,7 +235,8 @@ defmodule MastaniServer.Test.Mutation.CMSTest do
229
235
"""
230
236
test "auth user can add thread to community" , ~m( user community) a do
231
237
title = "psot"
232
- { :ok , thread } = CMS . create_thread ( ~m( title) a )
238
+ raw = title
239
+ { :ok , thread } = CMS . create_thread ( ~m( title raw) a )
233
240
variables = % { threadId: thread . id , communityId: community . id }
234
241
235
242
passport_rules = % { community . title => % { "thread.add" => true } }