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: {
|
dateOfEntry: {
|
||||||
type: Date,
|
type: Date,
|
||||||
default: new Date(),
|
default: Date.now,
|
||||||
},
|
},
|
||||||
gist: {
|
gist: {
|
||||||
description: String,
|
description: String,
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ const AnonymizedPullRequestSchema = new Schema({
|
|||||||
},
|
},
|
||||||
dateOfEntry: {
|
dateOfEntry: {
|
||||||
type: Date,
|
type: Date,
|
||||||
default: new Date(),
|
default: Date.now,
|
||||||
},
|
},
|
||||||
pullRequest: {
|
pullRequest: {
|
||||||
diff: String,
|
diff: String,
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ const AnonymizedRepositorySchema = new Schema({
|
|||||||
},
|
},
|
||||||
dateOfEntry: {
|
dateOfEntry: {
|
||||||
type: Date,
|
type: Date,
|
||||||
default: new Date(),
|
default: Date.now,
|
||||||
},
|
},
|
||||||
size: {
|
size: {
|
||||||
storage: {
|
storage: {
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ const RepositorySchema = new Schema({
|
|||||||
},
|
},
|
||||||
dateOfEntry: {
|
dateOfEntry: {
|
||||||
type: Date,
|
type: Date,
|
||||||
default: new Date(),
|
default: Date.now,
|
||||||
},
|
},
|
||||||
plan: {
|
plan: {
|
||||||
planID: String,
|
planID: String,
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ const RepositorySchema = new Schema({
|
|||||||
},
|
},
|
||||||
dateOfEntry: {
|
dateOfEntry: {
|
||||||
type: Date,
|
type: Date,
|
||||||
default: new Date(),
|
default: Date.now,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ const UserSchema = new Schema({
|
|||||||
},
|
},
|
||||||
dateOfEntry: {
|
dateOfEntry: {
|
||||||
type: Date,
|
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"); }
|
catch (error) { expect(error.message).to.equal("storage failed"); }
|
||||||
expect(model.status).to.equal("ready");
|
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 () {
|
it("omits an upstream length when later text is rewritten", async function () {
|
||||||
const File = require("../src/core/AnonymizedFile").default;
|
const File = require("../src/core/AnonymizedFile").default;
|
||||||
stub(config, "STREAMER_ENTRYPOINT", "");
|
stub(config, "STREAMER_ENTRYPOINT", "");
|
||||||
|
|||||||
Reference in New Issue
Block a user