-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathutilities_spec.rb
More file actions
32 lines (25 loc) · 1.17 KB
/
utilities_spec.rb
File metadata and controls
32 lines (25 loc) · 1.17 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
# frozen_string_literal: true
require 'spec_helper'
describe SplitIoClient::Utilities do
describe 'utilities epoch convertions returns correct values' do
let(:string_date) { '2007-11-03 13:18:05 UTC' }
let(:zero_second_string_date) { '2007-11-03 13:18 UTC' }
it 'validates to_epoch method converts string dates to epoc in seconds removing seconds' do
converted_to_seconds = SplitIoClient::Utilities.to_epoch(string_date)
expect(converted_to_seconds).to eq(Time.parse(zero_second_string_date).to_i)
end
it 'validates to_epoch_milis method converts string dates to epoc in milis removing seconds' do
converted_to_milis = SplitIoClient::Utilities.to_epoch_milis(string_date)
expect(converted_to_milis).to eq Time.parse(zero_second_string_date).to_i * 1000
end
end
it 'split bulk of data - split equally' do
items = Set['feature', 'feature-1', 'feature-2', 'feature-3', 'feature-4', 'feature-5', 'feature-6']
result = SplitIoClient::Utilities.split_bulk_to_send(items, 3)
puts result
expect(result.size).to eq 3
expect(result[0].size).to eq 3
expect(result[1].size).to eq 3
expect(result[2].size).to eq 1
end
end