-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWidgetHeatmapPlaceholderShapeTests.swift
More file actions
68 lines (62 loc) · 1.94 KB
/
Copy pathWidgetHeatmapPlaceholderShapeTests.swift
File metadata and controls
68 lines (62 loc) · 1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//
// WidgetHeatmapPlaceholderShapeTests.swift
// DevLog_Unit
//
// Created by opfic on 4/30/26.
//
import Foundation
import Testing
@testable import DevLog
struct WidgetHeatmapPlaceholderShapeTests {
@Test("Heatmap 위젯 placeholder는 현재 월과 분기의 실제 날짜 위치를 사용한다")
func heatmap_위젯_placeholder는_현재_월과_분기의_실제_날짜_위치를_사용한다() throws {
let calendar = Calendar(identifier: .gregorian)
let date = try #require(calendar.date(from: DateComponents(year: 2026, month: 5, day: 15)))
let widgetHeatmapPlaceholderShape = WidgetHeatmapPlaceholderShape(
date: date,
calendar: calendar
)
#expect(widgetHeatmapPlaceholderShape.currentMonthWeekCounts == [6])
#expect(widgetHeatmapPlaceholderShape.quarterWeekCounts == [5, 6, 5])
let currentMonth = try #require(widgetHeatmapPlaceholderShape.currentMonths.first)
#expect(currentMonth.weeks.count == 6)
#expect(currentMonth.weeks[0].days.map(\.isVisible) == [
false,
false,
false,
false,
false,
true,
true
])
#expect(currentMonth.weeks[5].days.map(\.isVisible) == [
true,
false,
false,
false,
false,
false,
false
])
let quarterMonths = widgetHeatmapPlaceholderShape.quarterMonths
#expect(quarterMonths.map(\.weeks.count) == [5, 6, 5])
#expect(quarterMonths[0].weeks[0].days.map(\.isVisible) == [
false,
false,
false,
true,
true,
true,
true
])
#expect(quarterMonths[2].weeks[4].days.map(\.isVisible) == [
true,
true,
true,
false,
false,
false,
false
])
}
}