-
Notifications
You must be signed in to change notification settings - Fork 4
/
gday_spec.rb
179 lines (168 loc) Β· 6.61 KB
/
gday_spec.rb
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# gday_spec.rb
# version 0.1.4
require 'rspec'
require_relative './gday'
RSpec.describe GDay do
let(:gday_instance) { GDay.new }
let(:calendar_data) do
<<~DATA
Thu Aug 08 Office
Length: 1 day, 0:00:00
8:00am πͺ’ Todo today / review GH Issues / run `todos`
Length: 0:30:00
8:30am π
Length: 0:30:00
8:30am πΈ Eat 3 frogs
Length: 0:30:00
8:45am πΈ 15m of Monarch categorization
Length: 0:15:00
9:00am π
Length: 0:30:00
9:00am 11W improvement mtg / IPM
Length: 1:00:00
9:30am π
Length: 0:30:00
10:00am π
Length: 0:30:00
10:00am π A-priority only focus time
Length: 1:30:00
10:30am π
Length: 0:30:00
11:00am π
Length: 0:30:00
11:00am Infra Standup
Length: 0:20:00
11:30am π
Length: 0:30:00
11:30am JPB / Lucy 1:1
Length: 0:30:00
12:00pm π
Length: 0:30:00
12:00pm Protocol Eng Sync
Length: 2:00:00
12:00pm Rottnek
Length: 0:30:00
12:30pm π
Length: 0:30:00
12:30pm Andy / Jonathan
Length: 0:30:00
1:00pm π
Length: 0:30:00
1:30pm π
Length: 0:30:00
1:30pm π Lunch
Length: 0:30:00
2:00pm π
Length: 0:30:00
2:00pm Reece / Jonathan
Length: 0:30:00
2:30pm π
Length: 0:30:00
2:30pm Justin / Jonathan
Length: 0:30:00
3:00pm π
Length: 0:30:00
3:00pm Groom stories in GH backlogs
Length: 1:00:00
3:00pm π§Ή Knock out ~3 nitty-gritties
Length: 0:30:00
3:30pm π
Length: 0:30:00
4:00pm π
Length: 0:30:00
4:15pm ICF 2025 Funding Proposal Jam
Length: 1:00:00
4:30pm π
Length: 0:30:00
5:00pm π
Length: 0:30:00
5:00pm π What did you π’ today?
Length: 0:15:00
DATA
end
before do
allow(gday_instance).to receive(:get_calendar_data).and_return(calendar_data)
gday_instance.instance_variable_set(:@calendar_data_no_color, gday_instance.send(:remove_ansi_codes, calendar_data))
end
describe '#initialize' do
it 'initializes with calendar data and removes ANSI codes' do
expected_data = calendar_data.gsub(/\e\[[0-9;]*m/, '')
actual_data = gday_instance.instance_variable_get(:@calendar_data_no_color)
expect(actual_data).to eq(expected_data)
end
end
describe '#add_pomodoro' do
it 'adds 30 minutes to a given time' do
expect(gday_instance.send(:add_pomodoro, '9:00am')).to eq('9:30am')
expect(gday_instance.send(:add_pomodoro, '11:45pm')).to eq('12:15am')
end
end
describe '#generate_header' do
it 'generates the correct header for a given day' do
allow(Date).to receive(:today).and_return(Date.parse('2024-08-08'))
expect(gday_instance.send(:generate_header)).to eq("# 08/08 - Thursday")
allow(Date).to receive(:today).and_return(Date.parse('2024-08-05'))
expect(gday_instance.send(:generate_header)).to eq("# 08/05 - Monday - π Week 32")
end
end
describe '#generate_body' do
it 'generates the correct body with time and items' do
gday_instance.instance_variable_set(:@lines, ["9:00am|Meeting with team", "9:30am|Code review"])
expect(gday_instance.send(:generate_body)).to eq("| 9:00am | π Meeting with team |\n| 9:30am | π€ Code review |\n")
end
end
describe '#process_calendar_data' do
it 'processes calendar data correctly' do
gday_instance.send(:process_calendar_data)
expect(gday_instance.instance_variable_get(:@lines)).to eq([
"8:00am|πͺ’ Todo today / review GH Issues / run `todos`",
"8:30am|π
",
"8:30am|πΈ Eat 3 frogs",
# "8:45am|πΈ 15m of Monarch categorization",
"9:00am|π
",
"9:00am|11W improvement mtg / IPM",
"9:30am|π
",
"10:00am|π
",
"10:00am|π A-priority only focus time",
"10:30am|π
",
"11:00am|π
",
"11:00am|Infra Standup",
"11:30am|π
",
"11:30am|JPB / Lucy 1:1",
"12:00pm|π
",
"12:00pm|Protocol Eng Sync",
"12:00pm|Rottnek",
"12:30pm|π
",
"12:30pm|Andy / Jonathan",
"1:00pm|π
",
"1:30pm|π
",
"1:30pm|π Lunch",
"2:00pm|π
",
"2:00pm|Reece / Jonathan",
"2:30pm|π
",
"2:30pm|Justin / Jonathan",
"3:00pm|π
",
"3:00pm|Groom stories in GH backlogs",
"3:00pm|π§Ή Knock out ~3 nitty-gritties",
"3:30pm|π
",
"4:00pm|π
",
"4:15pm|ICF 2025 Funding Proposal Jam",
"4:45pm|ICF 2025 Funding Proposal Jam",
"4:30pm|π
",
"5:00pm|π
",
"5:00pm|π What did you π’ today?"
])
end
end
describe "#foo" do
it "does something" do
puts "foo"
end
end
describe '#gday' do
it 'outputs the correct schedule' do
allow(Date).to receive(:today).and_return(Date.parse('2024-08-08'))
expect { gday_instance.gday }.not_to raise_error
end
end
end