Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Use header to get the client id #547

Merged
merged 31 commits into from
Mar 16, 2023
Merged
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
4b27b2c
fix: Use header to get the client id
Jordan-Hall Mar 8, 2023
ce8bfc5
fix(api): handle backward compatibility
Jordan-Hall Mar 8, 2023
d0e2f7c
fix: rename the env to prefix with FITLINK_
Jordan-Hall Mar 8, 2023
30a454b
fix: duplicated import
Jordan-Hall Mar 8, 2023
cf73c2c
fix: reapir health unit test
Jordan-Hall Mar 8, 2023
9137ea4
Fix: remove the forRoot and forFeature
Jordan-Hall Mar 8, 2023
ed2db27
dont use mocktype. .get and request is transit
Jordan-Hall Mar 8, 2023
5cdd4c8
fix: repair types
Jordan-Hall Mar 8, 2023
424e333
fit: repair unit test
Jordan-Hall Mar 8, 2023
f45dda9
fix: try mocling unit test a different way
Jordan-Hall Mar 12, 2023
0827d46
fix: try this way of unit testing
Jordan-Hall Mar 13, 2023
4ebddd6
feat: update to latest nestjs
Jordan-Hall Mar 13, 2023
1ff014e
Merge branch 'develop' into feat/427-bunld-ip-driven
Jordan-Hall Mar 13, 2023
f239326
fix: add request to provider
Jordan-Hall Mar 13, 2023
2076cc6
fix add missing import
Jordan-Hall Mar 13, 2023
0a5f68a
hacky work around for test as reques is always undefined even with ad…
Jordan-Hall Mar 13, 2023
d04152f
fix: repair that stupid error so brute force work
Jordan-Hall Mar 13, 2023
3b804dd
Fixed brute force when added the override provider
Jordan-Hall Mar 13, 2023
37c1d07
fix: more fixes
Jordan-Hall Mar 13, 2023
702b0a5
fix: changed the way it works
Jordan-Hall Mar 13, 2023
142888c
fix: match the new .env
Jordan-Hall Mar 13, 2023
943fc6f
Fix a couple more tests
Jordan-Hall Mar 13, 2023
302cae2
auth require the param decorator
Jordan-Hall Mar 13, 2023
affddf6
fix: remove the over write of request
Jordan-Hall Mar 16, 2023
a332e11
Merge branch 'develop' into feat/427-bunld-ip-driven
Jordan-Hall Mar 16, 2023
a46ae7f
feat: bad code just to fix unit tests
Jordan-Hall Mar 16, 2023
e7454a7
fix: repair JWT issue in tests
Jordan-Hall Mar 16, 2023
2076440
fix: repair the param for ClientIdParam
Jordan-Hall Mar 16, 2023
3e1c8ba
fix: param needs to grab from the header not the request
Jordan-Hall Mar 16, 2023
9df1158
fix: mock event emitter
Jordan-Hall Mar 16, 2023
e647640
fix: repair the unit test
Jordan-Hall Mar 16, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: mock event emitter
Signed-off-by: Jordan Hall <[email protected]>
  • Loading branch information
Jordan-Hall committed Mar 16, 2023
commit 9df11580d7df2e405faa8c42240490ba76081807
26 changes: 15 additions & 11 deletions apps/api/test/health-activities.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import { ContextId, ContextIdFactory, REQUEST } from '@nestjs/core'
import { CLIENT_ID } from '../src/modules/client-id/client-id'
import { mockApp } from './helpers/app'
import { Scope } from '@nestjs/common'
import { EventEmitter2 } from '@nestjs/event-emitter'

describe('Health Activities', () => {
let app: NestFastifyApplication
Expand Down Expand Up @@ -670,18 +671,21 @@ describe('Health Activities', () => {

it('POST /me/ping Updates Fitbit steps for qualifying users on ping from device', async () => {

await app.resolve(FitbitService, contextId).then((fitbitService) => {
fitbitService.fetchActivitySummaryByDay = jest.fn().mockReturnValueOnce(() => {
return {
summary: {
steps: 1999
}
}
})
fitbitService.getFreshFitbitToken = jest.fn().mockReturnValue('token')
return fitbitService;
});
const emitter = app.get(EventEmitter2)

emitter.emitAsync = jest.fn().mockImplementation(async (event, data) => {
const fitbitService = await app.resolve(FitbitService).then((fitbitService) => {
fitbitService.fetchActivitySummaryByDay = jest.fn().mockReturnValueOnce({
summary: {
steps: 1999
}
})
fitbitService.getFreshFitbitToken = jest.fn().mockReturnValue('token')
return fitbitService;
});

fitbitService.onUserPingEvent(data);
});

await app.inject({
method: 'PUT',
Expand Down