-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathdefault-promise-spec.js
46 lines (42 loc) · 1.22 KB
/
default-promise-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
/*!
* promised-handlebars <https://github.com/nknapp/promised-handlebars>
*
* Copyright (c) 2015 Nils Knappmeier.
* Released under the MIT license.
*/
/* global after */
/* global before */
/* global describe */
/* global it */
// /* global xdescribe */
// /* global xit */
'use strict'
var promisedHandlebars = require('../')
var promiseName = 'default Promise'
// Chai Setup
var chai = require('chai')
var expect = chai.expect
describe('promised-handlebars: ', function () {
if (global.Promise) {
describe('running with ' + promiseName, function () {
it('should not throw when global.Promise is defined', function () {
expect(function () { promisedHandlebars(require('handlebars')) }).to.not.throw()
})
})
describe('using ' + promiseName, function () {
before(function () {
this.Handlebars = promisedHandlebars(require('handlebars'))
})
after(function () {
delete this.Handlebars
})
require('./default-suite')()
})
} else {
describe('running with ' + promiseName, function () {
it('should throw when Promise is not defined', function () {
expect(function () { promisedHandlebars(require('handlebars')) }).to.throw()
})
})
}
})