Skip to content

Commit

Permalink
style: 코드 스타일 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
ekek54 committed Dec 12, 2022
1 parent 7d59915 commit c1e4382
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions server/src/User/User.Test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,16 @@ import app from "../app";

dotenv.config();

beforeAll(async () => {
const testUser = {
name: "testUser",
id: 58,
infAccessToken:
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6NTgsImlhdCI6MTY3MDgyODE2MH0.vQrK4E6RbQfPxpTt0cjBmhYVtlihWJelKSdssm2W45E",
infRefreshToken:
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6NTgsImlhdCI6MTY3MDgyODE2NH0.07bukMgpAcfDik8Umlg2UtTvVKmWFotf3AHy_legMWs",
};

const testUserRefreshToken = beforeAll(async () => {
const myDataSource = new DataSource({
type: "mysql",
host: process.env.TYPEORM_HOST || "",
Expand All @@ -25,19 +34,13 @@ beforeAll(async () => {

// 본인 유저 정보
describe("GET api/users", () => {
const testUserName = "testUser";
const testUserId = 58;
const testUserAccessToken =
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6NTgsImlhdCI6MTY3MDgyODE2MH0.vQrK4E6RbQfPxpTt0cjBmhYVtlihWJelKSdssm2W45E";
const testUserRefreshToken =
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6NTgsImlhdCI6MTY3MDgyODE2NH0.07bukMgpAcfDik8Umlg2UtTvVKmWFotf3AHy_legMWs";
test("로그인한 유저의 경우 유저 정보 반환", (done) => {
request(app)
.get("/api/users")
.set("Cookie", [`accessToken=${testUserAccessToken}`, `refreshToken=${testUserRefreshToken}`])
.set("Cookie", [`accessToken=${testUser.infAccessToken}`, `refreshToken=${testUser.infRefreshToken}`])
.expect(200)
.then((res) => {
expect(res.body).toEqual({ userID: testUserId, userName: testUserName });
expect(res.body).toEqual({ userID: testUser.id, userName: testUser.name });
done();
})
.catch((err) => {
Expand Down

0 comments on commit c1e4382

Please sign in to comment.