--- /dev/null
+/* eslint-env mocha */
+'use strict';
+
+const assert = require('assert');
+const common = require('../../lib/common');
+
+describe('Common', function () {
+
+ describe('fileScope', function () {
+ it('names a file path', function () {
+ const filename = 'lib/foo/bar.js';
+ const result = common.fileScope(filename)('baz');
+ assert.strictEqual(result, 'bar:baz');
+ });
+ it('names an index path', function () {
+ const filename = 'lib/foo/index.js';
+ const result = common.fileScope(filename)('baz');
+ assert.strictEqual(result, 'foo:baz');
+ });
+ }); // fileScope
+
+ describe('base64ToBase64URL', function () {
+ it('covers', function () {
+ const b64 = '/+==';
+ const expected = '_-';
+ const result = common.base64ToBase64URL(b64);
+ assert.strictEqual(result, expected);
+ });
+ }); // base64ToBase64URL
+
+ describe('base64URLToBase64', function () {
+ it('covers', function () {
+ const b64url = '_-';
+ const expected = '/+==';
+ const result = common.base64URLToBase64(b64url);
+ assert.strictEqual(result, expected);
+ });
+ }); // base64URLToBase64
+
+ describe('base64RePad', function () {
+ it('covers', function () {
+ const b64short = 'af';
+ const expected = 'af==';
+ const result = common.base64RePad(b64short);
+ assert.strictEqual(result, expected);
+ });
+ it('covers padded', function () {
+ const b64 = 'afd4';
+ const expected = b64;
+ const result = common.base64RePad(b64);
+ assert.strictEqual(result, expected);
+ });
+ }); // base64RePad
+
+}); // Common