mirror of
https://github.com/pocketbase/pocketbase.git
synced 2025-01-06 00:18:50 +02:00
added unique error test for the record update api
This commit is contained in:
parent
8317ae2e6b
commit
ac4a961a10
@ -1761,6 +1761,24 @@ func TestRecordCrudUpdate(t *testing.T) {
|
||||
`"id":{"code":"validation_in_invalid"`,
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "unique field error check",
|
||||
Method: http.MethodPatch,
|
||||
Url: "/api/collections/demo2/records/llvuca81nly1qls",
|
||||
Body: strings.NewReader(`{
|
||||
"title":"test2"
|
||||
}`),
|
||||
ExpectedStatus: 400,
|
||||
ExpectedContent: []string{
|
||||
`"data":{`,
|
||||
`"title":{`,
|
||||
`"code":"validation_not_unique"`,
|
||||
},
|
||||
ExpectedEvents: map[string]int{
|
||||
"OnRecordBeforeUpdateRequest": 1,
|
||||
"OnModelBeforeUpdate": 1,
|
||||
},
|
||||
},
|
||||
|
||||
// check whether if @request.data modifer fields are properly resolved
|
||||
// -----------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user