From ac4a961a1070214a73bedf98d0905aca4ab86289 Mon Sep 17 00:00:00 2001 From: Gani Georgiev Date: Thu, 13 Apr 2023 23:04:24 +0300 Subject: [PATCH] added unique error test for the record update api --- apis/record_crud_test.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/apis/record_crud_test.go b/apis/record_crud_test.go index 4af92795..1fa16b01 100644 --- a/apis/record_crud_test.go +++ b/apis/record_crud_test.go @@ -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 // -----------------------------------------------------------