UNPKG

1.9 kBJavaScriptView Raw
1/*
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
5 *
6 * http://www.apache.org/licenses/LICENSE-2.0
7 *
8 * Unless required by applicable law or agreed to in writing, software
9 * distributed under the License is distributed on an "AS IS" BASIS,
10 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 * See the License for the specific language governing permissions and
12 * limitations under the License.
13 */
14
15'use strict';
16
17const Util = require('../lib/util');
18
19const chai = require('chai');
20
21chai.should();
22chai.use(require('chai-things'));
23chai.use(require('chai-as-promised'));
24
25describe('Resolve root directory for Cucumber', () => {
26 it('Should resolve to given root directory', function () {
27 return Util.resolveRootDir({rootdir:'foo/bar'}).should.equal('foo/bar');
28 });
29 it('Should resolve to \'.\'', function () {
30 return Util.resolveRootDir({}).should.equal('.');
31 });
32});
33describe('Compare components corner cases', () => {
34 it('Should succeed comparing null against null', function () {
35 return (() => Util.compareComponent(null, null)).should.not.throw;
36 });
37 it('Should fail comparing null against 1', function () {
38 return (() => Util.compareComponent(null, 1)).should.throw('expected 1 to equal null');
39 });
40 it('Should succeed comparing undefined against undefined', function () {
41 return (() => Util.compareComponent(undefined, undefined)).should.not.throw;
42 });
43 it('Should fail comparing null against undefined', function () {
44 return (() => Util.compareComponent(null, undefined)).should.throw('expected undefined to equal null');
45 });
46 it('Should resolve to \'.\'', function () {
47 return Util.resolveRootDir({}).should.equal('.');
48 });
49});