mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 12:10:49 +00:00
remove mentions of scraped_on field from types & test cases
This commit is contained in:
parent
f920fc61ac
commit
77659efe1f
2 changed files with 8 additions and 12 deletions
|
|
@ -144,7 +144,6 @@ describe("aikido API", async () => {
|
||||||
package_name: "fresh-pkg",
|
package_name: "fresh-pkg",
|
||||||
version: "1.0.0",
|
version: "1.0.0",
|
||||||
released_on: 123,
|
released_on: 123,
|
||||||
scraped_on: 456,
|
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
mockFetch.mock.mockImplementationOnce(() => ({
|
mockFetch.mock.mockImplementationOnce(() => ({
|
||||||
|
|
|
||||||
|
|
@ -106,7 +106,7 @@ describe("newPackagesDatabase", async () => {
|
||||||
describe("isNewlyReleasedPackage", () => {
|
describe("isNewlyReleasedPackage", () => {
|
||||||
it("returns true for a package released within the age threshold", async () => {
|
it("returns true for a package released within the age threshold", async () => {
|
||||||
fetchedList = [
|
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();
|
const db = await openNewPackagesDatabase();
|
||||||
|
|
@ -115,7 +115,7 @@ describe("newPackagesDatabase", async () => {
|
||||||
|
|
||||||
it("returns false for a package released outside the age threshold", async () => {
|
it("returns false for a package released outside the age threshold", async () => {
|
||||||
fetchedList = [
|
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();
|
const db = await openNewPackagesDatabase();
|
||||||
|
|
@ -131,7 +131,7 @@ describe("newPackagesDatabase", async () => {
|
||||||
|
|
||||||
it("returns false for a known package but different version", async () => {
|
it("returns false for a known package but different version", async () => {
|
||||||
fetchedList = [
|
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();
|
const db = await openNewPackagesDatabase();
|
||||||
|
|
@ -145,14 +145,12 @@ describe("newPackagesDatabase", async () => {
|
||||||
package_name: "foo",
|
package_name: "foo",
|
||||||
version: "1.0.0",
|
version: "1.0.0",
|
||||||
released_on: hoursAgo(1),
|
released_on: hoursAgo(1),
|
||||||
scraped_on: hoursAgo(1),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
source: "npm",
|
source: "npm",
|
||||||
package_name: "bar",
|
package_name: "bar",
|
||||||
version: "1.0.0",
|
version: "1.0.0",
|
||||||
released_on: hoursAgo(1),
|
released_on: hoursAgo(1),
|
||||||
scraped_on: hoursAgo(1),
|
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
@ -165,7 +163,7 @@ describe("newPackagesDatabase", async () => {
|
||||||
it("respects a custom minimumPackageAgeHours threshold", async () => {
|
it("respects a custom minimumPackageAgeHours threshold", async () => {
|
||||||
minimumPackageAgeHours = 168; // 7 days
|
minimumPackageAgeHours = 168; // 7 days
|
||||||
fetchedList = [
|
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();
|
const db = await openNewPackagesDatabase();
|
||||||
|
|
@ -182,7 +180,7 @@ describe("newPackagesDatabase", async () => {
|
||||||
describe("caching behaviour", () => {
|
describe("caching behaviour", () => {
|
||||||
it("uses local cache when etag matches", async () => {
|
it("uses local cache when etag matches", async () => {
|
||||||
writeCachedList([
|
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");
|
], "etag-1");
|
||||||
fetchVersionResult = "etag-1";
|
fetchVersionResult = "etag-1";
|
||||||
// fetchedList is empty — if we used the remote list, the lookup would return false
|
// 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 () => {
|
it("fetches fresh list when etag does not match", async () => {
|
||||||
writeCachedList([
|
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");
|
], "etag-old");
|
||||||
fetchVersionResult = "etag-new";
|
fetchVersionResult = "etag-new";
|
||||||
fetchedList = [
|
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();
|
const db = await openNewPackagesDatabase();
|
||||||
|
|
@ -212,7 +210,6 @@ describe("newPackagesDatabase", async () => {
|
||||||
package_name: "cached-pkg",
|
package_name: "cached-pkg",
|
||||||
version: "1.0.0",
|
version: "1.0.0",
|
||||||
released_on: hoursAgo(1),
|
released_on: hoursAgo(1),
|
||||||
scraped_on: hoursAgo(1),
|
|
||||||
},
|
},
|
||||||
], "etag-old");
|
], "etag-old");
|
||||||
fetchVersionResult = "etag-new";
|
fetchVersionResult = "etag-new";
|
||||||
|
|
@ -227,7 +224,7 @@ describe("newPackagesDatabase", async () => {
|
||||||
|
|
||||||
it("emits a warning when list has no version (cannot be cached)", async () => {
|
it("emits a warning when list has no version (cannot be cached)", async () => {
|
||||||
fetchedList = [
|
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;
|
fetchedVersion = undefined;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue