forked from 4d-for-ios/gallery_api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.test.js
executable file
·47 lines (41 loc) · 1.29 KB
/
index.test.js
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
const chai = require('chai');
var expect = chai.expect;
chai.use(require('chai-url'));
const gallery_api = require('./index');
describe("baseURL", function(){
it("should return a base url", function(){
expect(gallery_api.baseURL).to.be.not.empty;
expect(gallery_api.baseURL).to.have.protocol('https');
});
});
describe("topics", function(){
it("should return 5 topics", function(){
expect(gallery_api.topics().length).to.equal(5);
});
});
describe("repositories", function(){
let topics = gallery_api.topics()
topics.forEach((topic, index) => {
it("should return repos for topic "+topic, function(done){
gallery_api.repositories(topic)
.then(function(repos) {
expect(repos.items.length).to.be.above(0);
done();
}, function(error) {
console.log(error);
});
});
});
});
describe("repository", function(){
let topic = "form-detail"
it("should return repo for topic "+topic, function(done){
gallery_api.repository(topic, "4d-go-mobile/form-detail-Cards")
.then(function(repo) {
expect(repo.name).to.be.not.empty;
done();
}, function(error) {
console.log(error);
});
});
});