-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[#7] Add user data model
- Loading branch information
Showing
20 changed files
with
3,929 additions
and
187 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,4 +10,6 @@ | |
**/dist | ||
**/coverage | ||
|
||
**/*.log | ||
|
||
**/.turbo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
import { describe, expect, it } from '@jest/globals' | ||
import request from 'supertest' | ||
import app from '../src/index' | ||
|
||
describe('GET /', () => { | ||
it('should return 200 OK', async () => { | ||
const response = await request(app).get('/') | ||
expect(response.status).toBe(200) | ||
describe('Index', () => { | ||
describe('GET /', () => { | ||
it('should return 200 OK', async () => { | ||
const response = await request(app).get('/') | ||
expect(response.status).toBe(200) | ||
}) | ||
}) | ||
}) |
30 changes: 30 additions & 0 deletions
30
backend/user-service/__tests__/models/user.repository.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { MongoDBContainer, StartedMongoDBContainer } from '@testcontainers/mongodb' | ||
import logger from '../../src/common/logger.util' | ||
import connectToDatabase from '../../src/common/mongodb.util' | ||
import { findOneUserByUsername } from '../../src/models/user.repository' | ||
|
||
describe('UserRepository', () => { | ||
let startedContainer: StartedMongoDBContainer | ||
|
||
beforeAll(async () => { | ||
const container: MongoDBContainer = new MongoDBContainer().withExposedPorts(27017) | ||
startedContainer = await container.start() | ||
|
||
const connectionString = `${startedContainer.getConnectionString()}?directConnection=true` | ||
logger.info(`[Index Test] MongoDB container started on ${connectionString}`) | ||
|
||
await connectToDatabase(connectionString) | ||
}, 60000) | ||
|
||
afterAll(async () => { | ||
await startedContainer.stop() | ||
logger.info(`[Index Test] MongoDB container stopped`) | ||
}) | ||
|
||
describe('findOneUserByUsername', () => { | ||
it('should return null when no user found', async () => { | ||
const user = await findOneUserByUsername('') | ||
expect(user).toBeNull() | ||
}) | ||
}) | ||
}) |
Oops, something went wrong.