summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorcall-me-matt <nextcloud@matthiasheinisch.de>2020-09-06 00:48:04 +0200
committercall-me-matt <nextcloud@matthiasheinisch.de>2020-09-06 00:48:04 +0200
commitba67a50ecedc7dfa9eba36992726504c0e6d39bc (patch)
tree1c84dd93e0df8374a325ca348136d8c879043f8d /tests
parent33a53fc732e9f65bf37d162cc449ef80ab122303 (diff)
perform sanity checks
Signed-off-by: call-me-matt <nextcloud@matthiasheinisch.de>
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/Service/SocialApiServiceTest.php20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/unit/Service/SocialApiServiceTest.php b/tests/unit/Service/SocialApiServiceTest.php
index 47442c88..47bd21ac 100644
--- a/tests/unit/Service/SocialApiServiceTest.php
+++ b/tests/unit/Service/SocialApiServiceTest.php
@@ -348,4 +348,24 @@ class SocialApiServiceTest extends TestCase {
$this->assertContains('Valid Contact Two', $report[0]['checked']);
}
}
+
+ public function testExistsContact() {
+ $this->setupAddressbooks();
+
+ // all good:
+ $result = $this->service->existsContact('11111111-1111-1111-1111-111111111111', 'contacts1', 'admin');
+ $this->assertEquals(true, $result);
+
+ // wrong address book:
+ $result = $this->service->existsContact('22222222-2222-2222-2222-222222222222', 'contacts1', 'admin');
+ $this->assertEquals(false, $result);
+
+ // invalid contactId:
+ $result = $this->service->existsContact('not-existing', 'contacts1', 'admin');
+ $this->assertEquals(false, $result);
+
+ // invalid addressbookId:
+ $result = $this->service->existsContact('11111111-1111-1111-1111-111111111111', 'not-existing', 'admin');
+ $this->assertEquals(false, $result);
+ }
}