Skip to content

Commit

Permalink
[CHORE] timeInterval 변수 적용 (#604)
Browse files Browse the repository at this point in the history
  • Loading branch information
MMMIIIN committed Dec 7, 2023
1 parent c0723eb commit dd3eab6
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 21 deletions.
4 changes: 2 additions & 2 deletions Manito/Manito/Util/Extension/Type/Date+Extension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ extension Date {
var isToday: Bool {
let now = Date()
let distance = self.distance(to: now)
return distance > 0 && distance < 86400
return distance > 0 && distance < .oneDayInterval
}

/// 해당 날짜가 지난날인지
var isPast: Bool {
let distance = self.distance(to: Date())
return distance > 86400
return distance > .oneDayInterval
}

/// Date 값을 yy.MM.dd 형식의 String 값으로 변환
Expand Down
12 changes: 4 additions & 8 deletions Manito/ManitoTests/Domain/Entity/RoomInfoTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,8 @@ final class RoomInfoTest: XCTestCase {

func test_canStart_방장이아니고_시작인원이4명이하고_시작날짜가오늘일때() {
// given
let oneTimeInterval: TimeInterval = 86400
let todayString = Date().toFullString
let endDate = todayString.toDefaultDate! + oneTimeInterval
let endDate = todayString.toDefaultDate! + .oneDayInterval
let endDateString = endDate.toFullString
let sut = RoomInfo(
roomInformation: RoomListItem(id: 0,
Expand Down Expand Up @@ -96,9 +95,8 @@ final class RoomInfoTest: XCTestCase {

func test_canStart_방장이아니고_시작인원이4명이상이고_시작날짜가오늘일때() {
// given
let oneTimeInterval: TimeInterval = 86400
let todayString = Date().toFullString
let endDate = todayString.toDefaultDate! + oneTimeInterval
let endDate = todayString.toDefaultDate! + .oneDayInterval
let endDateString = endDate.toFullString
let sut = RoomInfo(
roomInformation: RoomListItem(id: 0,
Expand Down Expand Up @@ -150,9 +148,8 @@ final class RoomInfoTest: XCTestCase {

func test_canStart_방장이고_시작인원이4명이하고_시작날짜가오늘일때() {
// given
let oneTimeInterval: TimeInterval = 86400
let todayString = Date().toFullString
let endDate = todayString.toDefaultDate! + oneTimeInterval
let endDate = todayString.toDefaultDate! + .oneDayInterval
let endDateString = endDate.toFullString
let sut = RoomInfo(
roomInformation: RoomListItem(id: 0,
Expand Down Expand Up @@ -204,9 +201,8 @@ final class RoomInfoTest: XCTestCase {

func test_canStart_방장이고_시작인원이4명이상이고_시작날짜가오늘일때() {
// given
let oneTimeInterval: TimeInterval = 86400
let todayString = Date().toFullString
let endDate = todayString.toDefaultDate! + oneTimeInterval
let endDate = todayString.toDefaultDate! + .oneDayInterval
let endDateString = endDate.toFullString
let sut = RoomInfo(
roomInformation: RoomListItem(id: 0,
Expand Down
2 changes: 1 addition & 1 deletion Manito/ManitoTests/Domain/Entity/RoomListItemTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ final class RoomListItemTest: XCTestCase {
func test_isStartDatePast_오늘날짜에대해_올바르게_반환하는가() {
// given
let today = Date()
let ondDay: TimeInterval = 86400
let ondDay: TimeInterval = .oneDayInterval
let todayAfterFiveDays = Date() + ondDay
let todayString = today.toFullString
let endDateString = todayAfterFiveDays.toFullString
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ final class DetailEditUsecaseTest: XCTestCase {

func test_vaildStartDateIsNotPast함수에_내일날짜가_들어갔을때() {
// given
let oneDay: TimeInterval = 86400
let tomorrow = (Date() + oneDay).toFullString
let tomorrow = (Date() + .oneDayInterval).toFullString
// when
let sut = self.mockUsecase.vaildStartDateIsNotPast(startDate: tomorrow)
// then
Expand Down
12 changes: 4 additions & 8 deletions Manito/ManitoTests/Util/Extension/Type/Date+ExtensionTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@ final class Date_ExtensionTest: XCTestCase {

func test_isToday_과거날짜에_올바르게_반환하는가() {
// given
let oneTimeInterval: TimeInterval = 86400
let dateString = Date().toFullString
let today = dateString.toFullDate!
let sut = today - oneTimeInterval
let sut = today - .oneDayInterval

// when
let isToday = sut.isToday
Expand All @@ -43,10 +42,9 @@ final class Date_ExtensionTest: XCTestCase {

func test_isToday_미래날짜에_올바르게_반환하는가() {
// given
let oneTimeInterval: TimeInterval = 86400
let dateString = Date().toFullString
let today = dateString.toFullDate!
let sut = today + oneTimeInterval
let sut = today + .oneDayInterval

// when
let isToday = sut.isToday
Expand All @@ -63,10 +61,9 @@ final class Date_ExtensionTest: XCTestCase {

func test_isPast_과거날짜에_올바르게_반환하는가() {
// given
let oneTimeInterval: TimeInterval = 86400
let dateString = Date().toFullString
let today = dateString.toFullDate!
let sut = today - oneTimeInterval
let sut = today - .oneDayInterval

// when
let isPast = sut.isPast
Expand All @@ -77,10 +74,9 @@ final class Date_ExtensionTest: XCTestCase {

func test_isPast_미래날짜에_올바르게_반환하는가() {
// given
let oneTimeInterval: TimeInterval = 86400
let dateString = Date().toFullString
let today = dateString.toFullDate!
let sut = today + oneTimeInterval
let sut = today + .oneDayInterval

// when
let isPast = sut.isPast
Expand Down

0 comments on commit dd3eab6

Please sign in to comment.