Move remaining alertSearch tests under test/.

Keep them beside the existing SMS alertSearch tests and update imports so they still load src/.
This commit is contained in:
Jose Olarte III
2026-09-18 14:53:41 +08:00
parent 93168ae360
commit 226925278f
8 changed files with 38 additions and 38 deletions
@@ -3,17 +3,17 @@ import { mkdtemp, rm } from "node:fs/promises";
import { tmpdir } from "node:os"; import { tmpdir } from "node:os";
import path from "node:path"; import path from "node:path";
import { afterEach, beforeEach, describe, it } from "node:test"; import { afterEach, beforeEach, describe, it } from "node:test";
import { alertSearchCursorsDb } from "../db/alertSearchCursorsSqlite.js"; import { alertSearchCursorsDb } from "../../src/db/alertSearchCursorsSqlite.js";
import { closeDatabase } from "../db/sqlite.js"; import { closeDatabase } from "../../src/db/sqlite.js";
import { import {
advanceAlertSearchCursors, advanceAlertSearchCursors,
loadAlertSearchCursors, loadAlertSearchCursors,
maxEndorserAlertSearchUlid, maxEndorserAlertSearchUlid,
} from "./cursors.js"; } from "../../src/alertSearch/cursors.js";
import { retrieveAlertSearch } from "./retrieve.js"; import { retrieveAlertSearch } from "../../src/alertSearch/retrieve.js";
import type { AlertSearchSourceResult, RetrieveAlertSearchResult } from "./retrieve.js"; import type { AlertSearchSourceResult, RetrieveAlertSearchResult } from "../../src/alertSearch/retrieve.js";
import { ALERT_SEARCH_PAGE_SIZE } from "./types.js"; import { ALERT_SEARCH_PAGE_SIZE } from "../../src/alertSearch/types.js";
import type { EndorserAlertSearchData, PartnerAlertSearchData } from "./types.js"; import type { EndorserAlertSearchData, PartnerAlertSearchData } from "../../src/alertSearch/types.js";
const USER = "did:ethr:0xcursoruser"; const USER = "did:ethr:0xcursoruser";
const OTHER_USER = "did:ethr:0xother"; const OTHER_USER = "did:ethr:0xother";
@@ -3,14 +3,14 @@ import { mkdtemp, rm } from "node:fs/promises";
import { tmpdir } from "node:os"; import { tmpdir } from "node:os";
import path from "node:path"; import path from "node:path";
import { afterEach, beforeEach, describe, it } from "node:test"; import { afterEach, beforeEach, describe, it } from "node:test";
import { alertSearchCursorsDb } from "../db/alertSearchCursorsSqlite.js"; import { alertSearchCursorsDb } from "../../src/db/alertSearchCursorsSqlite.js";
import { closeDatabase } from "../db/sqlite.js"; import { closeDatabase } from "../../src/db/sqlite.js";
import { import {
partnerPageHasTiedBeforeDate, partnerPageHasTiedBeforeDate,
type FetchLike, type FetchLike,
} from "./client.js"; } from "../../src/alertSearch/client.js";
import { runAlertSearchCycle } from "./cycle.js"; import { runAlertSearchCycle } from "../../src/alertSearch/cycle.js";
import { ALERT_SEARCH_PAGE_SIZE } from "./types.js"; import { ALERT_SEARCH_PAGE_SIZE } from "../../src/alertSearch/types.js";
const USER = "did:ethr:0xcycleuser"; const USER = "did:ethr:0xcycleuser";
const JWT = "delegated.jwt.token"; const JWT = "delegated.jwt.token";
@@ -8,12 +8,12 @@ import {
ALERT_JWT_STATUS_UNUSED, ALERT_JWT_STATUS_UNUSED,
alertAuthorizationDb, alertAuthorizationDb,
type AlertAuthorizationJwtInput, type AlertAuthorizationJwtInput,
} from "../db/alertAuthorizationSqlite.js"; } from "../../src/db/alertAuthorizationSqlite.js";
import { alertSearchCursorsDb } from "../db/alertSearchCursorsSqlite.js"; import { alertSearchCursorsDb } from "../../src/db/alertSearchCursorsSqlite.js";
import { closeDatabase } from "../db/sqlite.js"; import { closeDatabase } from "../../src/db/sqlite.js";
import type { FetchLike } from "./client.js"; import type { FetchLike } from "../../src/alertSearch/client.js";
import { runDailyAlertSearch } from "./daily.js"; import { runDailyAlertSearch } from "../../src/alertSearch/daily.js";
import { ALERT_SEARCH_PAGE_SIZE } from "./types.js"; import { ALERT_SEARCH_PAGE_SIZE } from "../../src/alertSearch/types.js";
const USER = "did:ethr:0xdailyuser"; const USER = "did:ethr:0xdailyuser";
const ENDORSER_BASE = "https://api.endorser.ch"; const ENDORSER_BASE = "https://api.endorser.ch";
@@ -4,9 +4,9 @@ import {
ALERT_SEARCH_DIGEST_BUCKETS, ALERT_SEARCH_DIGEST_BUCKETS,
alertSearchDigestDebugSummary, alertSearchDigestDebugSummary,
buildAlertSearchDigest, buildAlertSearchDigest,
} from "./digest.js"; } from "../../src/alertSearch/digest.js";
import { emptyEndorserData, emptyPartnerData } from "./client.js"; import { emptyEndorserData, emptyPartnerData } from "../../src/alertSearch/client.js";
import type { AlertSearchSourceResult, RetrieveAlertSearchResult } from "./retrieve.js"; import type { AlertSearchSourceResult, RetrieveAlertSearchResult } from "../../src/alertSearch/retrieve.js";
import type { import type {
AlertSearchClaimRecord, AlertSearchClaimRecord,
AlertSearchFailureReason, AlertSearchFailureReason,
@@ -17,7 +17,7 @@ import type {
CombinedAlertSearchData, CombinedAlertSearchData,
EndorserAlertSearchData, EndorserAlertSearchData,
PartnerAlertSearchData, PartnerAlertSearchData,
} from "./types.js"; } from "../../src/alertSearch/types.js";
function ulid(n: number): string { function ulid(n: number): string {
return `01H${String(n).padStart(23, "0")}`; return `01H${String(n).padStart(23, "0")}`;
@@ -3,10 +3,10 @@ import { mkdtemp, rm } from "node:fs/promises";
import { tmpdir } from "node:os"; import { tmpdir } from "node:os";
import path from "node:path"; import path from "node:path";
import { afterEach, beforeEach, describe, it } from "node:test"; import { afterEach, beforeEach, describe, it } from "node:test";
import { db as fcmDb } from "../db/fcmTokensSqlite.js"; import { db as fcmDb } from "../../src/db/fcmTokensSqlite.js";
import { closeDatabase } from "../db/sqlite.js"; import { closeDatabase } from "../../src/db/sqlite.js";
import type { DailyAlertSearchResult } from "./daily.js"; import type { DailyAlertSearchResult } from "../../src/alertSearch/daily.js";
import type { AlertSearchDigest } from "./digest.js"; import type { AlertSearchDigest } from "../../src/alertSearch/digest.js";
import { import {
ALERT_SEARCH_FCM_TYPE, ALERT_SEARCH_FCM_TYPE,
ALERT_SEARCH_NOTIFICATION_TITLE, ALERT_SEARCH_NOTIFICATION_TITLE,
@@ -14,7 +14,7 @@ import {
buildAlertSearchNotificationContent, buildAlertSearchNotificationContent,
deliverAlertSearchNotification, deliverAlertSearchNotification,
isAlertSearchNotificationEligible, isAlertSearchNotificationEligible,
} from "./notify.js"; } from "../../src/alertSearch/notify.js";
const USER = "did:ethr:0xnotifyuser"; const USER = "did:ethr:0xnotifyuser";
@@ -4,11 +4,11 @@ import {
alertSearchUrl, alertSearchUrl,
buildAlertSearchQuery, buildAlertSearchQuery,
isAlertSearchCursorUlid, isAlertSearchCursorUlid,
} from "./params.js"; } from "../../src/alertSearch/params.js";
import { import {
ENDORSER_ALERT_SEARCH_PATH, ENDORSER_ALERT_SEARCH_PATH,
PARTNER_ALERT_SEARCH_PATH, PARTNER_ALERT_SEARCH_PATH,
} from "./types.js"; } from "../../src/alertSearch/types.js";
const LOCATION = { const LOCATION = {
minLocLat: 40.7, minLocLat: 40.7,
@@ -5,9 +5,9 @@ import {
fetchPartnerAlertSearchPage, fetchPartnerAlertSearchPage,
nextEndorserBeforeId, nextEndorserBeforeId,
type FetchLike, type FetchLike,
} from "./client.js"; } from "../../src/alertSearch/client.js";
import { retrieveAlertSearch } from "./retrieve.js"; import { retrieveAlertSearch } from "../../src/alertSearch/retrieve.js";
import { ALERT_SEARCH_PAGE_SIZE, type EndorserAlertSearchData } from "./types.js"; import { ALERT_SEARCH_PAGE_SIZE, type EndorserAlertSearchData } from "../../src/alertSearch/types.js";
const JWT = "delegated.jwt.token"; const JWT = "delegated.jwt.token";
const ENDORSER_BASE = "https://api.endorser.ch"; const ENDORSER_BASE = "https://api.endorser.ch";
@@ -4,18 +4,18 @@ import { mkdtemp, rm } from "node:fs/promises";
import { tmpdir } from "node:os"; import { tmpdir } from "node:os";
import path from "node:path"; import path from "node:path";
import { afterEach, beforeEach, describe, it } from "node:test"; import { afterEach, beforeEach, describe, it } from "node:test";
import { alertAuthorizationDb } from "../db/alertAuthorizationSqlite.js"; import { alertAuthorizationDb } from "../../src/db/alertAuthorizationSqlite.js";
import { db as fcmDb } from "../db/fcmTokensSqlite.js"; import { db as fcmDb } from "../../src/db/fcmTokensSqlite.js";
import { closeDatabase } from "../db/sqlite.js"; import { closeDatabase } from "../../src/db/sqlite.js";
import type { DailyAlertSearchResult } from "./daily.js"; import type { DailyAlertSearchResult } from "../../src/alertSearch/daily.js";
import { import {
isAlertSearchSchedulerPassInFlight, isAlertSearchSchedulerPassInFlight,
resetAlertSearchSchedulerPassGuard, resetAlertSearchSchedulerPassGuard,
runAlertSearchSchedulerPass, runAlertSearchSchedulerPass,
startAlertSearchScheduler, startAlertSearchScheduler,
stopAlertSearchScheduler, stopAlertSearchScheduler,
} from "./scheduler.js"; } from "../../src/alertSearch/scheduler.js";
import type { AlertSearchDigest } from "./digest.js"; import type { AlertSearchDigest } from "../../src/alertSearch/digest.js";
const USER_A = "did:ethr:0xusera"; const USER_A = "did:ethr:0xusera";
const USER_B = "did:ethr:0xuserb"; const USER_B = "did:ethr:0xuserb";