-
Notifications
You must be signed in to change notification settings - Fork 3
/
TemplateCollection.spec.js
51 lines (34 loc) · 1.37 KB
/
TemplateCollection.spec.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
48
49
50
51
'use strict';
var chai = require('chai').use(require('chai-as-promised'));
var expect = chai.expect;
describe('Template Collection', function() {
var TemplateCollection = require('../lib/TemplateCollection');
var settings = require('./testConfig.json');
var testKey = settings.key;
var testUserAgent = settings.userAgent;
var testProject = settings.testProject;
var apiClient = require('../lib/API')(testKey, testUserAgent);
var collection = new TemplateCollection(testProject, apiClient);
describe('Constructor', function() {
it('should make a Template Collection', function () {
expect(collection).to.respondTo('all');
expect(collection).to.respondTo('find');
expect(collection).to.have.property('templates');
});
});
describe('All Templates', function() {
it('should list all templates', function() {
var firstTemplate = collection.all().then(function(templates) {
return templates[0];
});
return expect(firstTemplate).to.eventually.have.property('name');
return expect(firstTemplate).to.eventually.have.property('slug');
});
});
describe('Find Template', function() {
it('should find a template', function() {
return expect(collection.find('test')).to.eventually.have.property('name');
return expect(collection.find('test')).to.eventually.have.property('slug');
});
});
});