Skip to content

Commit 8877955

Browse files
committed
Fix tests.
1 parent afb9ac9 commit 8877955

File tree

1 file changed

+18
-19
lines changed

1 file changed

+18
-19
lines changed

test/async/service/formatting.rb

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -72,33 +72,32 @@
7272
expect(subject.format_count(1000000, custom_units)).to be == "1000.0K"
7373
end
7474

75-
it "handles empty units array" do
76-
expect(subject.format_count(1000, [])).to be == "1000.0"
77-
end
78-
79-
it "handles single nil unit" do
80-
expect(subject.format_count(1000, [nil])).to be == "1000.0"
81-
end
75+
it "handles empty units array" do
76+
expect(subject.format_count(1000, [])).to be == "1000"
8277
end
78+
79+
it "handles single nil unit" do
80+
expect(subject.format_count(1000, [nil])).to be == "1000"
81+
end end
8382
end
8483

8584
with "#format_ratio" do
8685
it "formats ratios with appropriate units" do
87-
expect(subject.format_ratio(23, 3420)).to be == "23.0/3.42K"
88-
expect(subject.format_ratio(2, 3420)).to be == "2.0/3.42K"
86+
expect(subject.format_ratio(23, 3420)).to be == "23/3.42K"
87+
expect(subject.format_ratio(2, 3420)).to be == "2/3.42K"
8988
end
9089

9190
it "handles large ratios" do
9291
expect(subject.format_ratio(1500000, 2340000000)).to be == "1.5M/2.34B"
9392
end
9493

9594
it "handles small ratios" do
96-
expect(subject.format_ratio(5, 100)).to be == "5.0/100.0"
95+
expect(subject.format_ratio(5, 100)).to be == "5/100"
9796
end
9897

9998
it "handles zero values" do
100-
expect(subject.format_ratio(0, 1000)).to be == "0.0/1.0K"
101-
expect(subject.format_ratio(100, 0)).to be == "100.0/0.0"
99+
expect(subject.format_ratio(0, 1000)).to be == "0/1.0K"
100+
expect(subject.format_ratio(100, 0)).to be == "100/0"
102101
end
103102
end
104103

@@ -118,20 +117,20 @@
118117
with "#format_statistics" do
119118
it "formats single values" do
120119
result = subject.format_statistics(connections: 23)
121-
expect(result).to be == "CONNECTIONS=23.0"
120+
expect(result).to be == "CONNECTIONS=23"
122121
end
123122

124123
it "formats ratios from arrays" do
125124
result = subject.format_statistics(c: [23, 3420])
126-
expect(result).to be == "C=23.0/3.42K"
125+
expect(result).to be == "C=23/3.42K"
127126
end
128127

129128
it "formats multiple statistics" do
130129
result = subject.format_statistics(
131130
c: [23, 3420],
132131
r: [2, 3420]
133132
)
134-
expect(result).to be == "C=23.0/3.42K R=2.0/3.42K"
133+
expect(result).to be == "C=23/3.42K R=2/3.42K"
135134
end
136135

137136
it "handles mixed statistic types" do
@@ -140,7 +139,7 @@
140139
active: 5,
141140
load: 0.273
142141
)
143-
expect(result).to be == "CONNECTIONS=23.0/3.42K ACTIVE=5.0 LOAD=0.27"
142+
expect(result).to be == "CONNECTIONS=23/3.42K ACTIVE=5 LOAD=0.27"
144143
end
145144

146145
it "handles arrays with more than 2 elements" do
@@ -158,7 +157,7 @@
158157
:symbol_key => 100,
159158
"string_key" => 200
160159
)
161-
expect(result).to be == "SYMBOL_KEY=100.0 STRING_KEY=200.0"
160+
expect(result).to be == "SYMBOL_KEY=100 STRING_KEY=200"
162161
end
163162
end
164163

@@ -175,7 +174,7 @@
175174
r: [active_count, request_count]
176175
)
177176

178-
expect(statistics).to be == "C=23.0/3.42K R=2.0/3.42K"
177+
expect(statistics).to be == "C=23/3.42K R=2/3.42K"
179178
end
180179

181180
it "formats process title information" do
@@ -192,7 +191,7 @@
192191
)
193192

194193
process_title = "#{service_name} (#{stats} L=#{formatted_load})"
195-
expect(process_title).to be == "web-server (C=23.0/3.42K R=2.0/3.42K L=0.27)"
194+
expect(process_title).to be == "web-server (C=23/3.42K R=2/3.42K L=0.27)"
196195
end
197196
end
198197
end

0 commit comments

Comments
 (0)