Skip to content
This repository has been archived by the owner on Jul 17, 2022. It is now read-only.

Commit

Permalink
fix: use uuid to generate usernames
Browse files Browse the repository at this point in the history
  • Loading branch information
coderbyheart committed Aug 25, 2021
1 parent ee40367 commit e415c3f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 27 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
"license": "(ISC OR GPL-3.0)",
"dependencies": {
"@graphql-tools/utils": "8.1.1",
"@nordicsemiconductor/random-words": "^5.0.0",
"@sinclair/typebox": "^0.20.0",
"@types/graphql-depth-limit": "^1.1.2",
"@types/lodash": "^4.14.170",
Expand Down
7 changes: 2 additions & 5 deletions src/tests/authentication.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// tslint:disable:ordered-imports
import { randomWords } from '@nordicsemiconductor/random-words'
import express, { Express } from 'express'
import { createServer, Server } from 'http'
import passport from 'passport'
Expand All @@ -12,6 +11,7 @@ import { json } from 'body-parser'
import registerUser from '../routes/register'
import login from '../routes/login'
import renewCookie from '../routes/me/cookie'
import { v4 } from 'uuid'

jest.setTimeout(15 * 1000)

Expand All @@ -20,9 +20,6 @@ passport.use(cookieAuthStrategy)

const tokenCookieRx = new RegExp(`${authCookieName}=([^;]+);`, 'i')

const generateUsername = async () =>
(await randomWords({ numWords: 3 })).join('-')

describe('User account API', () => {
let app: Express
let httpServer: Server
Expand All @@ -31,7 +28,7 @@ describe('User account API', () => {
let password: string
let authCookie: string
beforeAll(async () => {
username = await generateUsername()
username = v4()
password = 'y{uugBmw"9,?=L_'
app = express()
app.use(cookieParser(process.env.COOKIE_SECRET ?? 'cookie-secret'))
Expand Down
22 changes: 1 addition & 21 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1421,13 +1421,6 @@
"@nodelib/fs.scandir" "2.1.5"
fastq "^1.6.0"

"@nordicsemiconductor/random-words@^5.0.0":
version "5.0.0"
resolved "https://registry.yarnpkg.com/@nordicsemiconductor/random-words/-/random-words-5.0.0.tgz#9cb2a30f98408ef7edbfd85eaec6b8516727d9ac"
integrity sha512-io/F9llmFligKtNgQFiGHW+S1wBIjaINKZ1Nb+q68tTokkFga2axwYHhZ0eO1G1K9+stJLasGIgJN+scvNvkig==
dependencies:
random-number-csprng "^1.0.2"

"@protobufjs/aspromise@^1.1.1", "@protobufjs/aspromise@^1.1.2":
version "1.1.2"
resolved "https://registry.yarnpkg.com/@protobufjs/aspromise/-/aspromise-1.1.2.tgz#9b8b0cc663d669a7d8f6f5d0893a14d348f30fbf"
Expand Down Expand Up @@ -2426,7 +2419,7 @@ binary-extensions@^2.0.0:
resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.2.0.tgz#75f502eeaf9ffde42fc98829645be4ea76bd9e2d"
integrity sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==

bluebird@^3.3.3, bluebird@^3.7.2:
bluebird@^3.7.2:
version "3.7.2"
resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f"
integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==
Expand Down Expand Up @@ -3047,11 +3040,6 @@ [email protected], cosmiconfig@^7.0.0:
path-type "^4.0.0"
yaml "^1.10.0"

create-error@^0.3.1:
version "0.3.1"
resolved "https://registry.yarnpkg.com/create-error/-/create-error-0.3.1.tgz#69810245a629e654432bf04377360003a5351a23"
integrity sha1-aYECRaYp5lRDK/BDdzYAA6U1GiM=

create-require@^1.1.0:
version "1.1.1"
resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333"
Expand Down Expand Up @@ -6728,14 +6716,6 @@ queue-microtask@^1.2.2:
resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243"
integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==

random-number-csprng@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/random-number-csprng/-/random-number-csprng-1.0.2.tgz#fcd120e62dffc2c07674c7c3fe01e16b25f73a26"
integrity sha1-/NEg5i3/wsB2dMfD/gHhayX3OiY=
dependencies:
bluebird "^3.3.3"
create-error "^0.3.1"

range-parser@~1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.1.tgz#3cf37023d199e1c24d1a55b84800c2f3e6468031"
Expand Down

0 comments on commit e415c3f

Please sign in to comment.