xvideosx 1.4.4 → 1.4.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,139 @@
1
+ /* eslint-disable import/no-unresolved */
2
+ /* eslint-disable padded-blocks */
3
+
4
+ const chai = require('chai');
5
+ const fresh = require('./fresh');
6
+
7
+ before(() => {
8
+ chai.should();
9
+ });
10
+
11
+ describe('api/videos/newFresh', () => {
12
+
13
+ it('should list fresh video pages', async () => {
14
+ const list = await fresh({ page: 2 });
15
+
16
+ list.should.be.an('object');
17
+ list.pagination.should.be.an('object');
18
+ list.pagination.page.should.be.equals(2);
19
+ list.pagination.pages.should.be.an('array');
20
+ list.pagination.pages[0].should.be.a('number');
21
+ list.hasNext.should.be.a('function');
22
+ list.hasNext().should.be.equals(true);
23
+ list.hasPrevious.should.be.a('function');
24
+ list.hasPrevious().should.be.equals(true);
25
+ list.next.should.be.a('function');
26
+ list.previous.should.be.a('function');
27
+ list.videos.should.be.an('array');
28
+ list.videos.forEach((video) => {
29
+ video.should.be.an('object');
30
+ video.should.have.ownPropertyDescriptor('duration');
31
+ video.duration.should.be.a('string');
32
+ video.should.have.ownPropertyDescriptor('path');
33
+ video.path.should.be.a('string');
34
+ video.should.have.ownPropertyDescriptor('profile');
35
+ video.profile.should.be.an('object');
36
+ video.profile.should.have.ownPropertyDescriptor('name');
37
+ video.profile.name.should.be.an('string');
38
+ video.profile.should.have.ownPropertyDescriptor('url');
39
+ video.profile.url.should.be.an('string');
40
+ video.should.have.ownPropertyDescriptor('title');
41
+ video.title.should.be.a('string');
42
+ video.should.have.ownPropertyDescriptor('url');
43
+ video.url.should.be.a('string');
44
+ video.should.have.ownPropertyDescriptor('views');
45
+ video.views.should.be.a('string');
46
+ });
47
+
48
+ const previous = await list.previous();
49
+ previous.should.be.an('object');
50
+ previous.pagination.should.be.an('object');
51
+ previous.pagination.page.should.be.equals(1);
52
+ previous.pagination.pages.should.be.an('array');
53
+ previous.pagination.pages[0].should.be.a('number');
54
+ previous.hasNext.should.be.a('function');
55
+ previous.hasNext().should.be.equals(true);
56
+ previous.hasPrevious.should.be.a('function');
57
+ previous.hasPrevious().should.be.equals(false);
58
+ previous.next.should.be.a('function');
59
+ previous.previous.should.be.a('function');
60
+ previous.videos.should.be.an('array');
61
+ previous.videos.forEach((video) => {
62
+ video.should.be.an('object');
63
+ video.should.have.ownPropertyDescriptor('duration');
64
+ video.duration.should.be.a('string');
65
+ video.should.have.ownPropertyDescriptor('path');
66
+ video.path.should.be.a('string');
67
+ video.should.have.ownPropertyDescriptor('profile');
68
+ video.profile.should.be.an('object');
69
+ video.profile.should.have.ownPropertyDescriptor('name');
70
+ video.profile.name.should.be.an('string');
71
+ video.profile.should.have.ownPropertyDescriptor('url');
72
+ video.profile.url.should.be.an('string');
73
+ video.should.have.ownPropertyDescriptor('title');
74
+ video.title.should.be.a('string');
75
+ video.should.have.ownPropertyDescriptor('url');
76
+ video.url.should.be.a('string');
77
+ video.should.have.ownPropertyDescriptor('views');
78
+ video.views.should.be.a('string');
79
+ });
80
+
81
+ const next = await list.next();
82
+ next.should.be.an('object');
83
+ next.pagination.should.be.an('object');
84
+ next.pagination.page.should.be.equals(3);
85
+ next.pagination.pages.should.be.an('array');
86
+ next.pagination.pages[0].should.be.a('number');
87
+ next.hasNext.should.be.a('function');
88
+ next.hasNext().should.be.equals(true);
89
+ next.hasPrevious.should.be.a('function');
90
+ next.hasPrevious().should.be.equals(true);
91
+ next.next.should.be.a('function');
92
+ next.previous.should.be.a('function');
93
+ next.videos.should.be.an('array');
94
+ next.videos.forEach((video) => {
95
+ video.should.be.an('object');
96
+ video.should.have.ownPropertyDescriptor('duration');
97
+ video.duration.should.be.a('string');
98
+ video.should.have.ownPropertyDescriptor('path');
99
+ video.path.should.be.a('string');
100
+ video.should.have.ownPropertyDescriptor('profile');
101
+ video.profile.should.be.an('object');
102
+ video.profile.should.have.ownPropertyDescriptor('name');
103
+ video.profile.name.should.be.an('string');
104
+ video.profile.should.have.ownPropertyDescriptor('url');
105
+ video.profile.url.should.be.an('string');
106
+ video.should.have.ownPropertyDescriptor('title');
107
+ video.title.should.be.a('string');
108
+ video.should.have.ownPropertyDescriptor('url');
109
+ video.url.should.be.a('string');
110
+ video.should.have.ownPropertyDescriptor('views');
111
+ video.views.should.be.a('string');
112
+ });
113
+
114
+ await list.refresh();
115
+ }).timeout(10000);
116
+
117
+ it('should fail when page parameter is beyond limit', async () => {
118
+ let err;
119
+ try {
120
+ await fresh({ page: Number.MAX_SAFE_INTEGER + 1 });
121
+ } catch (error) {
122
+ err = error;
123
+ } finally {
124
+ err.should.be.an('error');
125
+ }
126
+ }).timeout(10000);
127
+
128
+ it('should fail when page parameter is less than 1', async () => {
129
+ let err;
130
+ try {
131
+ await fresh({ page: 0 });
132
+ } catch (error) {
133
+ err = error;
134
+ } finally {
135
+ err.should.be.an('error');
136
+ }
137
+ }).timeout(10000);
138
+
139
+ });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "xvideosx",
3
3
  "description": "xvideos.com api implementation.",
4
- "version": "1.4.4",
4
+ "version": "1.4.5",
5
5
  "main": "index.js",
6
6
  "license": "BSD-3-Clause",
7
7
  "repository": {