LP1840050 IDL pkeyMatches function/tests
[working/Evergreen.git] / Open-ILS / src / eg2 / src / app / core / idl.spec.ts
index 8138bf4..49439fd 100644 (file)
@@ -24,5 +24,33 @@ describe('IdlService', () => {
         expect(org.name()).toBe('AN ORG');
     });
 
+    it('should correctly compare IDL pkey values', () => {
+        service.parseIdl();
+        const org1 = service.create('aou');
+        const org2 = service.create('aou');
+        org1.id(123);
+        org2.id(123);
+        expect(service.pkeyMatches(org1, org2)).toBe(true);
+    });
+
+    it('should correctly compare IDL pkey values', () => {
+        service.parseIdl();
+        const org1 = service.create('aou');
+        const org2 = service.create('aou');
+        org1.id(123);
+        org2.id(456);
+        expect(service.pkeyMatches(org1, org2)).toBe(false);
+    });
+
+    it('should correctly compare IDL classes in pkey match', () => {
+        service.parseIdl();
+        const org = service.create('aou');
+        const user = service.create('au');
+        org.id(123);
+        user.id(123);
+        expect(service.pkeyMatches(org, user)).toBe(false);
+    });
+
+
 });