Skip to content

Commit

Permalink
test(user controller): user controller unit test
Browse files Browse the repository at this point in the history
test #122
  • Loading branch information
alejandrosaenz117 committed Jul 16, 2020
1 parent 4c52d49 commit aa53b54
Show file tree
Hide file tree
Showing 6 changed files with 396 additions and 44 deletions.
153 changes: 153 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
"jest": "^26.1.0",
"nodemon": "^2.0.4",
"rimraf": "^3.0.2",
"sqlite3": "^5.0.0",
"standard-version": "^8.0.2",
"ts-jest": "^26.1.2",
"tslint": "^6.1.2",
Expand Down
1 change: 0 additions & 1 deletion src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ app.listen(serverPort, () => console.info(`Server running on ${serverIpAddress}:
// create typeorm connection
createConnection().then((_) => {
// register routes
app.post('/api/user/create', jwtMiddleware.checkToken, userController.create);
app.post('/api/user/register', userController.register);
app.post('/api/user/invite', jwtMiddleware.checkToken, userController.invite);
app.patch('/api/user', jwtMiddleware.checkToken, userController.patch);
Expand Down
22 changes: 16 additions & 6 deletions src/entity/User.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,35 @@ import { IsEmail, IsUUID, IsAlpha, IsOptional } from 'class-validator';

@Entity()
export class User {
@PrimaryGeneratedColumn()
@PrimaryGeneratedColumn({})
id: number;
@Column({
unique: true
})
@IsEmail()
email: string;
@Column()
@Column({
nullable: true
})
password: string;
@Column()
active: boolean;
@Column()
@Column({
nullable: true
})
@IsOptional()
@IsUUID()
uuid: string;
@Column()
@Column({
nullable: true
})
firstName: string;
@Column()
@Column({
nullable: true
})
lastName: string;
@Column()
@Column({
nullable: true
})
title: string;
}
Loading

0 comments on commit aa53b54

Please sign in to comment.