separate validateClientIdentifier from fetchClientIdentifier, add validateProfile
[squeep-indieauth-helper] / test / lib / common.js
index 05a0cfcb11b02668bf813486ec7deaa0c87a1cdf..fe0240718bf8192f8e3761219ef33fd665e8d544 100644 (file)
@@ -88,4 +88,36 @@ describe('common', function () {
     });
   }); // axiosResponseLogData
 
+  describe('setSymmetricDifference', function () {
+    it('covers difference', function () {
+      const setA = new Set([1, 2, 3]);
+      const setB = new Set([2, 3, 4]);
+      const expected = new Set([1, 4]);
+      const result = common.setSymmetricDifference(setA, setB);
+      assert(result.size);
+      assert.deepStrictEqual(result, expected);
+    });
+    it('covers no difference', function () {
+      const setA = new Set([1, 2, 3, 4]);
+      const setB = new Set([1, 2, 3, 4]);
+      const expected = new Set();
+      const result = common.setSymmetricDifference(setA, setB);
+      assert(!result.size);
+      assert.deepStrictEqual(result, expected);
+    });
+  }); // setSymmetricDifference
+
+  describe('properURLComponentName', function () {
+    it('maps proper names', function () {
+      [
+        ['hash', 'fragment'],
+        ['protocol', 'scheme'],
+        ['host', 'host'],
+      ].forEach(([name, expected]) => {
+        const result = common.properURLComponentName(name);
+        assert.strictEqual(result, expected);
+      });
+    });
+  }); // properURLComponentName
+
 }); // common
\ No newline at end of file