From 894a05ec8cf24e37e62c5340e445db68b2cc436a Mon Sep 17 00:00:00 2001 From: Arne Zeising Date: Fri, 8 Apr 2022 12:02:26 +0200 Subject: [PATCH] Add tests --- force_test.go | 22 ++++++++++++++++++++++ sobject_test.go | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/force_test.go b/force_test.go index 36c3be7..ae66221 100644 --- a/force_test.go +++ b/force_test.go @@ -125,6 +125,28 @@ func TestClient_Query2(t *testing.T) { } } +func TestClient_Query3(t *testing.T) { + client := requireClient(t, true) + + q := "SELECT Id FROM CaseComment WHERE CommentBody = 'This comment is created by simpleforce & used for testing'" + result, err := client.Query(q) + if err != nil { + log.Println(logPrefix, "query failed,", err) + t.FailNow() + } + + log.Println(logPrefix, result.TotalSize, result.Done, result.NextRecordsURL) + if result.TotalSize < 1 { + log.Println(logPrefix, "no records returned.") + t.FailNow() + } + for _, record := range result.Records { + if record.Type() != "CaseComment" { + t.Fail() + } + } +} + func TestClient_ApexREST(t *testing.T) { client := requireClient(t, true) diff --git a/sobject_test.go b/sobject_test.go index d214cb0..a6556d0 100644 --- a/sobject_test.go +++ b/sobject_test.go @@ -150,7 +150,7 @@ func TestSObject_Create(t *testing.T) { // Positive 2 caseComment1 := client.SObject("CaseComment") caseComment1Result := caseComment1.Set("ParentId", case1Result.ID()). - Set("CommentBody", "This comment is created by simpleforce"). + Set("CommentBody", "This comment is created by simpleforce & used for testing"). Set("IsPublished", true). Create() if caseComment1Result.Get().SObjectField("Case", "ParentId").ID() != case1Result.ID() {