diff --git a/test/db.ts b/test/db.ts index 9586ffc..b7bfcba 100644 --- a/test/db.ts +++ b/test/db.ts @@ -1,4 +1,7 @@ import { ObjectId } from 'mongodb'; + +import { getEnv } from 'universe/backend/env'; + import { dummyRootData, getCommonDummyData, @@ -38,7 +41,7 @@ const users: InternalUser[] = [ // ? Dummy users' passwords are the same as their usernames { _id: new ObjectId(), - $provenance: dummyRootData.auth[0].attributes.owner, + __provenance: dummyRootData.auth[0].attributes.owner, username: 'user1', salt: '91db41c494502f9ebb6217e4590cccc2', key: '17660270f4c4c1741ab9d43e6fb800bc784f0a3bc2f4cd31f0e26bf821ef2ae788f83af134d8c3824f5e0552f8cd432d6b23963d2ffbceb6a7c91b0f59533206', @@ -47,7 +50,7 @@ const users: InternalUser[] = [ }, { _id: new ObjectId(), - $provenance: dummyRootData.auth[0].attributes.owner, + __provenance: dummyRootData.auth[0].attributes.owner, username: 'user2', salt: 'bfe69b665a1ae64bb7d76c32347adecb', key: 'e71e8bbd23df52bec8af8280ad7901ddd0ecd5cc43371915f7a95cd17ce0a8515127bfcd433435425c4d245f4a18efcb08e4484682aeb53fcfce5b536d79e4e4', @@ -56,7 +59,7 @@ const users: InternalUser[] = [ }, { _id: new ObjectId(), - $provenance: dummyRootData.auth[0].attributes.owner, + __provenance: dummyRootData.auth[0].attributes.owner, username: 'user3', salt: '12ef85b518da764294abf0a2095bb5ec', key: 'e745893e064e26d4349b1639b1596c14bc9b5d050b56bf31ff3ef0dfce6f959aef8a3722a35bc35b2d142169e75ca3e1967cd6ee4818af0813d8396a724fdd22', @@ -70,7 +73,7 @@ const users: InternalUser[] = [ }, { _id: new ObjectId(), - $provenance: dummyRootData.auth[0].attributes.owner, + __provenance: dummyRootData.auth[0].attributes.owner, username: null, salt: '12ef85b518da764294abf0a2095bb5ec', key: 'e745893e064e26d4349b1639b1596c14bc9b5d050b56bf31ff3ef0dfce6f959aef8a3722a35bc35b2d142169e75ca3e1967cd6ee4818af0813d8396a724fdd22', @@ -87,7 +90,7 @@ const users: InternalUser[] = [ const pages: InternalPage[] = [ { _id: new ObjectId(), - $provenance: dummyRootData.auth[0].attributes.owner, + __provenance: dummyRootData.auth[0].attributes.owner, blog_id: users[2]._id, createdAt: mockDateNowMs - 10_000, name: 'contact', @@ -96,7 +99,7 @@ const pages: InternalPage[] = [ }, { _id: new ObjectId(), - $provenance: dummyRootData.auth[0].attributes.owner, + __provenance: dummyRootData.auth[0].attributes.owner, blog_id: new ObjectId(), createdAt: mockDateNowMs - 1000, name: 'orphan', @@ -105,7 +108,7 @@ const pages: InternalPage[] = [ }, { _id: new ObjectId(), - $provenance: dummyRootData.auth[0].attributes.owner, + __provenance: dummyRootData.auth[0].attributes.owner, blog_id: users[2]._id, createdAt: mockDateNowMs - 100_000, name: 'home', @@ -118,23 +121,24 @@ const pages: InternalPage[] = [ const sessions: InternalSession[] = [ { _id: new ObjectId(), - $provenance: dummyRootData.auth[0].attributes.owner, + __provenance: dummyRootData.auth[0].attributes.owner, lastRenewedDate: new Date(mockDateNowMs), - blog_id: users[2]._id, page_id: pages[0]._id }, { _id: new ObjectId(), - $provenance: dummyRootData.auth[0].attributes.owner, - lastRenewedDate: new Date(mockDateNowMs - 25_000), - blog_id: users[2]._id, + __provenance: dummyRootData.auth[0].attributes.owner, + lastRenewedDate: new Date( + mockDateNowMs - Math.floor(getEnv().SESSION_EXPIRE_AFTER_SECONDS / 2) * 1000 + ), page_id: pages[0]._id }, { _id: new ObjectId(), - $provenance: dummyRootData.auth[0].attributes.owner, - lastRenewedDate: new Date(mockDateNowMs - 60_000), - blog_id: users[2]._id, + __provenance: dummyRootData.auth[0].attributes.owner, + lastRenewedDate: new Date( + mockDateNowMs - getEnv().SESSION_EXPIRE_AFTER_SECONDS * 2000 + ), page_id: pages[0]._id } ];