Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
176 changes: 88 additions & 88 deletions lib/data.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,100 +3,100 @@ import { describe, expect, test } from "bun:test";
import type { DetectedTechnology } from "./parsers/types";

const DOMAIN_TO_UNEXPECTED_DATA: Record<string, DetectedTechnology[]> = {
"changelog.com": [
{
identifier: "subdomain",
metadata: {
value: "op3.dev",
},
},
],
"changelog.com": [
{
identifier: "subdomain",
metadata: {
value: "op3.dev",
},
},
],
};

const DOMAIN_TO_EXPECTED_DATA: Record<string, DetectedTechnology[]> = {
"lastwatchdog.com": [
{
identifier: "rss",
metadata: {
url: "https://www.lastwatchdog.com/feed/",
},
},
],
"formkeep.com": [
{
identifier: "github",
metadata: {
username: "formkeep.js",
},
},
{
identifier: "linkedin",
metadata: { username: "formkeep" },
},
],
"savvycal.com": [
{
identifier: "twitter",
metadata: { username: "savvycal" },
},
{
identifier: "rss",
metadata: { url: "https://savvycal.com/feed.xml" },
},
{
identifier: "rewardful",
metadata: { value: "rewardful", via: "URL" },
},
],
"buttondown.email": [
{
identifier: "github",
metadata: { username: "buttondown" },
},
],
"zed.dev": [
{
identifier: "twitter",
metadata: { username: "zeddotdev" },
},
],
"bytereview.co.uk": [
{
identifier: "tiktok",
metadata: { username: "@bytereview" },
},
{
identifier: "twitter",
metadata: { username: "bytereview" },
},
],
"lastwatchdog.com": [
{
identifier: "rss",
metadata: {
url: "https://www.lastwatchdog.com/feed/",
},
},
],
"formkeep.com": [
{
identifier: "github",
metadata: {
username: "formkeep.js",
},
},
{
identifier: "linkedin",
metadata: { username: "formkeep" },
},
],
"savvycal.com": [
{
identifier: "rewardful",
metadata: { value: "rewardful", via: "URL" },
},
{
identifier: "google_workspace",
metadata: { genre: "Mailserver" },
},
],
"buttondown.email": [
{
identifier: "github",
metadata: { username: "buttondown" },
},
{
identifier: "google_workspace",
metadata: { genre: "Mailserver" },
},
],
"zed.dev": [
{
identifier: "twitter",
metadata: { username: "zeddotdev" },
},
],
"bytereview.co.uk": [
{
identifier: "tiktok",
metadata: { username: "@bytereview" },
},
{
identifier: "twitter",
metadata: { username: "bytereview" },
},
],
};

describe("fetching", () => {
Object.entries(DOMAIN_TO_EXPECTED_DATA).forEach(([domain, expectedData]) => {
expectedData.forEach((data) => {
test(`fetches ${data.identifier} for ${domain}`, async () => {
const { detected_technologies } = await fetch(domain);
expect(detected_technologies).toContainEqual(data);
});
});
});
Object.entries(DOMAIN_TO_EXPECTED_DATA).forEach(([domain, expectedData]) => {
expectedData.forEach((data) => {
test(`fetches ${data.identifier} for ${domain}`, async () => {
const { detected_technologies } = await fetch(domain);
expect(detected_technologies).toContainEqual(data);
});
});
});

Object.entries(DOMAIN_TO_UNEXPECTED_DATA).forEach(
([domain, unexpectedData]) => {
unexpectedData.forEach((data) => {
test(`does not fetch ${data.identifier} for ${domain}`, async () => {
const { detected_technologies } = await fetch(domain);
expect(detected_technologies).not.toContainEqual(data);
});
});
},
);
Object.entries(DOMAIN_TO_UNEXPECTED_DATA).forEach(
([domain, unexpectedData]) => {
unexpectedData.forEach((data) => {
test(`does not fetch ${data.identifier} for ${domain}`, async () => {
const { detected_technologies } = await fetch(domain);
expect(detected_technologies).not.toContainEqual(data);
});
});
},
);

test("deduping identical records", async () => {
const { detected_technologies } = await fetch("zed.dev");
expect(
detected_technologies.filter((tech) => tech.identifier === "twitter"),
).toHaveLength(1);
});
test("deduping identical records", async () => {
const { detected_technologies } = await fetch("zed.dev");
expect(
detected_technologies.filter((tech) => tech.identifier === "twitter"),
).toHaveLength(1);
});
});
14 changes: 14 additions & 0 deletions lib/services.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1442,6 +1442,20 @@ export const REGISTRY: { [key in string]: Service } = {
"spf2.mailgun.org",
],
},
google_workspace: {
identifier: "google_workspace",
name: "Google Workspace",
url: "https://workspace.google.com",
genre: "email",
mx_values: [
"aspmx.l.google.com",
"alt1.aspmx.l.google.com",
"alt2.aspmx.l.google.com",
"alt3.aspmx.l.google.com",
"alt4.aspmx.l.google.com",
],
spf_values: ["_spf.google.com"],
},
campaign_monitor: {
identifier: "campaign_monitor",
name: "Campaign Monitor",
Expand Down