mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-09-02 09:00:59 +02:00
fix: reactivate repositories with future expiration (#781)
This commit is contained in:
@@ -8,6 +8,7 @@ const {
|
||||
} = require("../src/server/routes/conference");
|
||||
const {
|
||||
hasRepositorySourceChanged,
|
||||
shouldReactivateExpiredRepository,
|
||||
} = require("../src/server/routes/repository-private");
|
||||
const {
|
||||
processRemoveRepository,
|
||||
@@ -79,6 +80,47 @@ describe("repository update source detection", function () {
|
||||
})
|
||||
).to.equal(true);
|
||||
});
|
||||
|
||||
it("rebuilds an expired repository when its expiration is in the future", function () {
|
||||
const now = new Date("2026-08-20T00:00:00.000Z");
|
||||
expect(
|
||||
shouldReactivateExpiredRepository(
|
||||
{
|
||||
status: "expired",
|
||||
options: {
|
||||
expirationMode: "redirect",
|
||||
expirationDate: new Date("2027-05-01T03:57:53.395Z"),
|
||||
},
|
||||
},
|
||||
now
|
||||
)
|
||||
).to.equal(true);
|
||||
});
|
||||
|
||||
it("does not rebuild an expired repository with a stale expiration", function () {
|
||||
const now = new Date("2026-08-20T00:00:00.000Z");
|
||||
expect(
|
||||
shouldReactivateExpiredRepository(
|
||||
{
|
||||
status: "expired",
|
||||
options: {
|
||||
expirationMode: "redirect",
|
||||
expirationDate: new Date("2026-01-01T00:00:00.000Z"),
|
||||
},
|
||||
},
|
||||
now
|
||||
)
|
||||
).to.equal(false);
|
||||
});
|
||||
|
||||
it("rebuilds an expired repository configured never to expire", function () {
|
||||
expect(
|
||||
shouldReactivateExpiredRepository({
|
||||
status: "expired",
|
||||
options: { expirationMode: "never" },
|
||||
})
|
||||
).to.equal(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe("removal workers", function () {
|
||||
|
||||
Reference in New Issue
Block a user