remove mentions of scraped_on field from types & test cases

This commit is contained in:
BitterPanda 2026-03-27 16:10:18 -07:00
parent f920fc61ac
commit 77659efe1f
2 changed files with 8 additions and 12 deletions

View file

@ -144,7 +144,6 @@ describe("aikido API", async () => {
package_name: "fresh-pkg",
version: "1.0.0",
released_on: 123,
scraped_on: 456,
},
];
mockFetch.mock.mockImplementationOnce(() => ({

View file

@ -106,7 +106,7 @@ describe("newPackagesDatabase", async () => {
describe("isNewlyReleasedPackage", () => {
it("returns true for a package released within the age threshold", async () => {
fetchedList = [
{ package_name: "foo", version: "1.0.0", released_on: hoursAgo(1), scraped_on: hoursAgo(1) },
{ package_name: "foo", version: "1.0.0", released_on: hoursAgo(1) },
];
const db = await openNewPackagesDatabase();
@ -115,7 +115,7 @@ describe("newPackagesDatabase", async () => {
it("returns false for a package released outside the age threshold", async () => {
fetchedList = [
{ package_name: "foo", version: "1.0.0", released_on: hoursAgo(48), scraped_on: hoursAgo(48) },
{ package_name: "foo", version: "1.0.0", released_on: hoursAgo(48) },
];
const db = await openNewPackagesDatabase();
@ -131,7 +131,7 @@ describe("newPackagesDatabase", async () => {
it("returns false for a known package but different version", async () => {
fetchedList = [
{ package_name: "foo", version: "2.0.0", released_on: hoursAgo(1), scraped_on: hoursAgo(1) },
{ package_name: "foo", version: "2.0.0", released_on: hoursAgo(1) },
];
const db = await openNewPackagesDatabase();
@ -145,14 +145,12 @@ describe("newPackagesDatabase", async () => {
package_name: "foo",
version: "1.0.0",
released_on: hoursAgo(1),
scraped_on: hoursAgo(1),
},
{
source: "npm",
package_name: "bar",
version: "1.0.0",
released_on: hoursAgo(1),
scraped_on: hoursAgo(1),
},
];
@ -165,7 +163,7 @@ describe("newPackagesDatabase", async () => {
it("respects a custom minimumPackageAgeHours threshold", async () => {
minimumPackageAgeHours = 168; // 7 days
fetchedList = [
{ package_name: "foo", version: "1.0.0", released_on: hoursAgo(100), scraped_on: hoursAgo(100) },
{ package_name: "foo", version: "1.0.0", released_on: hoursAgo(100) },
];
const db = await openNewPackagesDatabase();
@ -182,7 +180,7 @@ describe("newPackagesDatabase", async () => {
describe("caching behaviour", () => {
it("uses local cache when etag matches", async () => {
writeCachedList([
{ package_name: "cached-pkg", version: "1.0.0", released_on: hoursAgo(1), scraped_on: hoursAgo(1) },
{ package_name: "cached-pkg", version: "1.0.0", released_on: hoursAgo(1) },
], "etag-1");
fetchVersionResult = "etag-1";
// fetchedList is empty — if we used the remote list, the lookup would return false
@ -194,11 +192,11 @@ describe("newPackagesDatabase", async () => {
it("fetches fresh list when etag does not match", async () => {
writeCachedList([
{ package_name: "stale-pkg", version: "1.0.0", released_on: hoursAgo(1), scraped_on: hoursAgo(1) },
{ package_name: "stale-pkg", version: "1.0.0", released_on: hoursAgo(1) },
], "etag-old");
fetchVersionResult = "etag-new";
fetchedList = [
{ package_name: "fresh-pkg", version: "2.0.0", released_on: hoursAgo(1), scraped_on: hoursAgo(1) },
{ package_name: "fresh-pkg", version: "2.0.0", released_on: hoursAgo(1) },
];
const db = await openNewPackagesDatabase();
@ -212,7 +210,6 @@ describe("newPackagesDatabase", async () => {
package_name: "cached-pkg",
version: "1.0.0",
released_on: hoursAgo(1),
scraped_on: hoursAgo(1),
},
], "etag-old");
fetchVersionResult = "etag-new";
@ -227,7 +224,7 @@ describe("newPackagesDatabase", async () => {
it("emits a warning when list has no version (cannot be cached)", async () => {
fetchedList = [
{ package_name: "foo", version: "1.0.0", released_on: hoursAgo(1), scraped_on: hoursAgo(1) },
{ package_name: "foo", version: "1.0.0", released_on: hoursAgo(1) },
];
fetchedVersion = undefined;