mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-09-12 13:48:58 +02:00
fix: evaluate document creation timestamps per instance
This commit is contained in:
@@ -37,7 +37,7 @@ const AnonymizedGistSchema = new Schema({
|
||||
},
|
||||
dateOfEntry: {
|
||||
type: Date,
|
||||
default: new Date(),
|
||||
default: Date.now,
|
||||
},
|
||||
gist: {
|
||||
description: String,
|
||||
|
||||
@@ -38,7 +38,7 @@ const AnonymizedPullRequestSchema = new Schema({
|
||||
},
|
||||
dateOfEntry: {
|
||||
type: Date,
|
||||
default: new Date(),
|
||||
default: Date.now,
|
||||
},
|
||||
pullRequest: {
|
||||
diff: String,
|
||||
|
||||
@@ -59,7 +59,7 @@ const AnonymizedRepositorySchema = new Schema({
|
||||
},
|
||||
dateOfEntry: {
|
||||
type: Date,
|
||||
default: new Date(),
|
||||
default: Date.now,
|
||||
},
|
||||
size: {
|
||||
storage: {
|
||||
|
||||
@@ -32,7 +32,7 @@ const RepositorySchema = new Schema({
|
||||
},
|
||||
dateOfEntry: {
|
||||
type: Date,
|
||||
default: new Date(),
|
||||
default: Date.now,
|
||||
},
|
||||
plan: {
|
||||
planID: String,
|
||||
|
||||
@@ -34,7 +34,7 @@ const RepositorySchema = new Schema({
|
||||
},
|
||||
dateOfEntry: {
|
||||
type: Date,
|
||||
default: new Date(),
|
||||
default: Date.now,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ const UserSchema = new Schema({
|
||||
},
|
||||
dateOfEntry: {
|
||||
type: Date,
|
||||
default: new Date(),
|
||||
default: Date.now,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -286,6 +286,17 @@ describe("production regressions", function () {
|
||||
catch (error) { expect(error.message).to.equal("storage failed"); }
|
||||
expect(model.status).to.equal("ready");
|
||||
});
|
||||
|
||||
it("creates fresh entry dates for each document", async function () {
|
||||
const models = [
|
||||
["users", "users"], ["repositories", "repositories"], ["conference", "conferences"],
|
||||
["anonymizedRepositories", "anonymizedRepositories"], ["anonymizedGists", "anonymizedGists"],
|
||||
["anonymizedPullRequests", "anonymizedPullRequests"],
|
||||
].map(([folder, name]) => require(`../src/core/model/${folder}/${name}.model`).default);
|
||||
const first = models.map(Model => new Model().dateOfEntry);
|
||||
await new Promise(resolve => setTimeout(resolve, 15));
|
||||
models.forEach((Model, i) => expect(new Model().dateOfEntry.getTime()).to.be.greaterThan(first[i].getTime()));
|
||||
});
|
||||
it("omits an upstream length when later text is rewritten", async function () {
|
||||
const File = require("../src/core/AnonymizedFile").default;
|
||||
stub(config, "STREAMER_ENTRYPOINT", "");
|
||||
|
||||
Reference in New Issue
Block a user