Add tests for each service

This commit is contained in:
miku86 2021-10-09 19:13:01 +02:00
parent 8e6d206c8d
commit 30b9cf9c4e
8 changed files with 100 additions and 0 deletions

View File

@ -0,0 +1,10 @@
"use strict";
import helper from "../assets/javascripts/helpers/google-maps";
const instances = helper.redirects;
describe("Helper", () => {
test("There is at least 1 redirect instance in the config", () => {
expect(instances.length).toBeGreaterThan(0);
});
});

View File

@ -0,0 +1,30 @@
"use strict";
import helper from "../assets/javascripts/helpers/google-search";
const instances = helper.redirects;
describe("Helper", () => {
const instanceObjectKeys = ["link", "q"];
test("There is at least 1 redirect instance in the config", () => {
expect(instances.length).toBeGreaterThan(0);
});
test("Each entry has all object keys", () => {
// for readability: `every` instead of short-circuit `some`
const hasAllKeys = instances.every((instance) =>
instanceObjectKeys.every((key) => instance.hasOwnProperty(key))
);
expect(hasAllKeys).toBeTruthy();
});
test("Each entry has all object values", () => {
// for readability: `every` instead of short-circuit `some`
const hasAllValues = instances.every((instance) =>
instanceObjectKeys.every((key) => instance[key])
);
expect(hasAllValues).toBeTruthy();
});
});

View File

@ -0,0 +1,10 @@
"use strict";
import helper from "../assets/javascripts/helpers/google-translate";
const instances = helper.redirects;
describe("Helper", () => {
test("There is at least 1 redirect instance in the config", () => {
expect(instances.length).toBeGreaterThan(0);
});
});

View File

@ -0,0 +1,10 @@
"use strict";
import helper from "../assets/javascripts/helpers/instagram";
const instances = helper.redirects;
describe("Helper", () => {
test("There is at least 1 redirect instance in the config", () => {
expect(instances.length).toBeGreaterThan(0);
});
});

View File

@ -0,0 +1,10 @@
"use strict";
import helper from "../assets/javascripts/helpers/reddit";
const instances = helper.redirects;
describe("Helper", () => {
test("There is at least 1 redirect instance in the config", () => {
expect(instances.length).toBeGreaterThan(0);
});
});

View File

@ -0,0 +1,10 @@
"use strict";
import helper from "../assets/javascripts/helpers/twitter";
const instances = helper.redirects;
describe("Helper", () => {
test("There is at least 1 redirect instance in the config", () => {
expect(instances.length).toBeGreaterThan(0);
});
});

View File

@ -0,0 +1,10 @@
"use strict";
import helper from "../assets/javascripts/helpers/wikipedia";
const instances = helper.redirects;
describe("Helper", () => {
test("There is at least 1 redirect instance in the config", () => {
expect(instances.length).toBeGreaterThan(0);
});
});

View File

@ -0,0 +1,10 @@
"use strict";
import helper from "../assets/javascripts/helpers/youtube";
const instances = helper.redirects;
describe("Helper", () => {
test("There is at least 1 redirect instance in the config", () => {
expect(instances.length).toBeGreaterThan(0);
});
});