Add `arrived` attribute (file creation timestamp) to books table.
[quanlib.git] / test / store_test.rb
1
2 require 'rspec/autorun'
3 require_relative '../store'
4
5 describe Store do
6   it "construct_efs_path produces paths and filenames as expected" do
7     data = [
8       [      1234, '00/00/00/12', '0000001234.dat'],
9       [         1, '00/00/00/00', '0000000001.dat'],
10       [1234567890, '12/34/56/78', '1234567890.dat'],
11       [   7778123, '00/07/77/81', '0007778123.dat'],
12       [      0x1b, '00/00/00/00', '0000000027.dat']
13     ]
14
15     store = Store.new('quanlib.ini')
16
17     data.each do |input, expectedPath, expectedName|
18       (actualPath, actualName) = store.construct_efs_path(input)
19
20       expect(actualPath).to eq(expectedPath)
21       expect(actualName).to eq(expectedName)
22     end
23   end
24 end