summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-02-01 21:49:01 +0100
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-02-01 21:49:01 +0100
commit2026ea59112b89dd8829e23236fa482ef84a2e31 (patch)
treec236474edb8e5a9f39193d518da2219759835bfd /src/test
parent:globe_with_meridians: localization (diff)
downloadserver-2026ea59112b89dd8829e23236fa482ef84a2e31.tar.xz
:sparkles: added defaults to config
Diffstat (limited to 'src/test')
-rw-r--r--src/test/jwt2.ts13
-rw-r--r--src/test/mongo_test.ts9
2 files changed, 17 insertions, 5 deletions
diff --git a/src/test/jwt2.ts b/src/test/jwt2.ts

index ca73a035..e231233d 100644 --- a/src/test/jwt2.ts +++ b/src/test/jwt2.ts
@@ -1,8 +1,13 @@ import jwt from "jsonwebtoken"; -// console.log(jwt.sign("test", "test")); +const algorithm = "HS256"; +const iat = Math.floor(Date.now() / 1000); -jwt.verify(`${"2WmFS_EAdYFCBOFM9pVPo9g4bpuI2I9U_JGTCfrx7Tk".repeat(1000000)}`, "test", (err, decoded) => { - if (err) console.error(err); - console.log(decoded); +// @ts-ignore +const token = jwt.sign({ id: "311129357362135041" }, "secret", { + algorithm, }); +console.log(token); + +const decoded = jwt.verify(token, "secret", { algorithms: [algorithm] }); +console.log(decoded); diff --git a/src/test/mongo_test.ts b/src/test/mongo_test.ts
index c4b3ec37..ad290198 100644 --- a/src/test/mongo_test.ts +++ b/src/test/mongo_test.ts
@@ -1,7 +1,7 @@ import mongoose from "mongoose"; async function main() { - const mongoConnection = await mongoose.createConnection( + const conn = await mongoose.createConnection( "mongodb://localhost:27017/lambert?readPreference=secondaryPreferred", { useNewUrlParser: true, @@ -9,6 +9,13 @@ async function main() { } ); console.log("connected"); + const result = await conn + .collection("users") + .find({ $or: [{ email: "samuel.scheit@gmail.com" }, { phone: "samuel.scheit@gmail.com" }] }) + .toArray(); + // .project(undefined) + + console.log(result); } main();