UNPKG

1.13 kBJavaScriptView Raw
1const { Attachment } = require('../index');
2
3describe('Attachment', () => {
4 it('should create attachment from params', () => {
5 const { attachment } = new Attachment('wall', -1, 1);
6
7 expect(attachment).toBe('wall-1_1');
8 });
9
10 it('should create attachment from params with hash', () => {
11 const { attachment } = new Attachment('wall', -10, 100, 'hash');
12
13 expect(attachment).toBe('wall-10_100_hash');
14 });
15
16 it('should create attachment from string', () => {
17 const { attachment } = new Attachment('wall-29060604_448799_hash');
18
19 expect(attachment).toBe('wall-29060604_448799_hash');
20 });
21
22 it('should create attachment from API object', () => {
23 const { attachment } = new Attachment({
24 type: 'photo',
25 photo: {
26 id: 1,
27 album_id: 4,
28 owner_id: -1,
29 user_id: 100,
30 text: '',
31 date: 1577826000,
32 sizes: []
33 }
34 });
35
36 expect(attachment).toBe('photo-1_1');
37 });
38});