Skip to content

Commit

Permalink
test: 멤버 상태에 따른 정렬 함수 테스트
Browse files Browse the repository at this point in the history
  • Loading branch information
surinkwon committed Jun 13, 2024
1 parent 10d625b commit 85ebf39
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions frontend/src/test/sortMemberByStatus.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { LandingMemberDTO } from "../types/DTO/landingDTO";
import sortMemberByStatus from "../utils/sortMemberByStatus";

describe("sortMemberByStatus test", () => {
it("on, away, off 순 정렬 테스트", () => {
const memberList: LandingMemberDTO[] = [
{ id: 1, username: "", imageUrl: "", status: "off" },
{ id: 2, username: "", imageUrl: "", status: "on" },
{ id: 3, username: "", imageUrl: "", status: "away" },
{ id: 4, username: "", imageUrl: "", status: "on" },
{ id: 5, username: "", imageUrl: "", status: "off" },
{ id: 6, username: "", imageUrl: "", status: "away" },
];

const sortedMemberIdList = memberList
.sort(sortMemberByStatus)
.map(({ id }) => id);
expect(sortedMemberIdList).toStrictEqual([2, 4, 3, 6, 1, 5]);
});
});

0 comments on commit 85ebf39

Please sign in to comment.