Skip to content

Commit

Permalink
UTs for big attachments
Browse files Browse the repository at this point in the history
  • Loading branch information
L-Eugene committed Mar 22, 2024
1 parent 58aae27 commit 0e8c211
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 0 deletions.
11 changes: 11 additions & 0 deletions spec/fixtures/vk_informer_attachment/doc/hash.big.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"type": "doc",
"doc": {
"id": 123456,
"owner_id": 123,
"title": "file.gif",
"ext": "gif",
"size": 57344720,
"url": "http://example.com/file.gif"
}
}
1 change: 1 addition & 0 deletions spec/fixtures/vk_informer_attachment/doc/hash.gif.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"owner_id": 123,
"title": "file.gif",
"ext": "gif",
"size": 51380224,
"url": "http://example.com/file.gif"
}
}
1 change: 1 addition & 0 deletions spec/fixtures/vk_informer_attachment/doc/hash.simple.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"owner_id": 123,
"title": "file.txt",
"ext": "txt",
"size": 51380224,
"url": "http://example.com/file.txt"
}
}
15 changes: 15 additions & 0 deletions spec/unit_test/vk/vk_informer_doc_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@
"#{File.dirname(__FILE__)}/../../fixtures/vk_informer_attachment/doc/hash.gif.json"
)
)

@obj3 = Vk::Doc.new(
'x',
load_json_fixtures(
"#{File.dirname(__FILE__)}/../../fixtures/vk_informer_attachment/doc/hash.big.json"
)
)
end

describe 'Basic' do
Expand Down Expand Up @@ -47,6 +54,14 @@
expect(h[:disable_web_page_preview]).to be false
end

it 'should build result hash for doc if file is bigger than 50 Mb' do
h = @obj3.to_hash
expect(h).to be_instance_of(Hash)
expect(h).to have_key(:text)
expect(h).to have_key(:disable_web_page_preview)
expect(h[:disable_web_page_preview]).to be false
end

it 'should build result hash for link with peview' do
h = @obj2.to_hash
expect(h).to be_instance_of(Hash)
Expand Down

0 comments on commit 0e8c211

Please sign in to comment.