From 69c1f584321e9cfe4d73a3b6046f6336e4956156 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Fri, 19 Mar 2021 12:33:44 +0100 Subject: [PATCH] fixed tests for locations --- backend/.env.template | 1 + backend/src/config/index.js | 2 +- .../schema/resolvers/users/location.spec.js | 42 +++++++++++++++---- 3 files changed, 35 insertions(+), 10 deletions(-) diff --git a/backend/.env.template b/backend/.env.template index fc9766478..2d2374698 100644 --- a/backend/.env.template +++ b/backend/.env.template @@ -17,6 +17,7 @@ PRIVATE_KEY_PASSPHRASE="a7dsf78sadg87ad87sfagsadg78" SENTRY_DSN_BACKEND= COMMIT= PUBLIC_REGISTRATION=false +INVITE_REGISTRATION=true AWS_ACCESS_KEY_ID= AWS_SECRET_ACCESS_KEY= diff --git a/backend/src/config/index.js b/backend/src/config/index.js index b23832eae..b7d500b8b 100644 --- a/backend/src/config/index.js +++ b/backend/src/config/index.js @@ -83,7 +83,7 @@ const options = { APPLICATION_NAME: metadata.APPLICATION_NAME, ORGANIZATION_URL: links.ORGANIZATION, PUBLIC_REGISTRATION: env.PUBLIC_REGISTRATION === 'true' || false, - INVITE_REGISTRATION: env.INVITE_REGISTRATION !== 'false', //default = true + INVITE_REGISTRATION: env.INVITE_REGISTRATION !== 'false', // default = true } // Check if all required configs are present diff --git a/backend/src/schema/resolvers/users/location.spec.js b/backend/src/schema/resolvers/users/location.spec.js index 41b784249..1ef427034 100644 --- a/backend/src/schema/resolvers/users/location.spec.js +++ b/backend/src/schema/resolvers/users/location.spec.js @@ -114,10 +114,22 @@ describe('Location Service', () => { const result = await query({ query: queryLocations, variables }) expect(result.data.queryLocations).toEqual([ { id: 'place.14094307404564380', place_name: 'Berlin, Germany' }, - { id: 'place.15095411613564380', place_name: 'Berlin, Maryland, United States' }, - { id: 'place.5225018734564380', place_name: 'Berlin, Connecticut, United States' }, - { id: 'place.16922023226564380', place_name: 'Berlin, New Jersey, United States' }, - { id: 'place.4035845612564380', place_name: 'Berlin Township, New Jersey, United States' }, + { + id: expect.stringMatching(/^place\.[0-9]+$/), + place_name: 'Berlin, Maryland, United States', + }, + { + id: expect.stringMatching(/^place\.[0-9]+$/), + place_name: 'Berlin, Connecticut, United States', + }, + { + id: expect.stringMatching(/^place\.[0-9]+$/), + place_name: 'Berlin, New Jersey, United States', + }, + { + id: expect.stringMatching(/^place\.[0-9]+$/), + place_name: 'Berlin Township, New Jersey, United States', + }, ]) }) @@ -128,11 +140,23 @@ describe('Location Service', () => { } const result = await query({ query: queryLocations, variables }) expect(result.data.queryLocations).toEqual([ - { id: 'place.14094307404564380', place_name: 'Berlin, Deutschland' }, - { id: 'place.15095411613564380', place_name: 'Berlin, Maryland, Vereinigte Staaten' }, - { id: 'place.16922023226564380', place_name: 'Berlin, New Jersey, Vereinigte Staaten' }, - { id: 'place.10735893248465990', place_name: 'Berlin Heights, Ohio, Vereinigte Staaten' }, - { id: 'place.1165756679564380', place_name: 'Berlin, Massachusetts, Vereinigte Staaten' }, + { id: expect.stringMatching(/^place\.[0-9]+$/), place_name: 'Berlin, Deutschland' }, + { + id: expect.stringMatching(/^place\.[0-9]+$/), + place_name: 'Berlin, Maryland, Vereinigte Staaten', + }, + { + id: expect.stringMatching(/^place\.[0-9]+$/), + place_name: 'Berlin, New Jersey, Vereinigte Staaten', + }, + { + id: expect.stringMatching(/^place\.[0-9]+$/), + place_name: 'Berlin Heights, Ohio, Vereinigte Staaten', + }, + { + id: expect.stringMatching(/^place\.[0-9]+$/), + place_name: 'Berlin, Massachusetts, Vereinigte Staaten', + }, ]) })