You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					32 lines
				
				1.0 KiB
			
		
		
			
		
	
	
					32 lines
				
				1.0 KiB
			| 
								 
											3 years ago
										 
									 | 
							
								"use strict";
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								var _chai = require("chai");
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								var _viewHelpers = _interopRequireDefault(require("./view-helpers"));
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								describe('ViewHelpers', function () {
							 | 
						||
| 
								 | 
							
								  describe('#urlBuilder', function () {
							 | 
						||
| 
								 | 
							
								    it('returns joined path for default rootUrl', function () {
							 | 
						||
| 
								 | 
							
								      const h = new _viewHelpers.default({});
							 | 
						||
| 
								 | 
							
								      (0, _chai.expect)(h.urlBuilder(['my', 'path'])).to.equal('/admin/my/path');
							 | 
						||
| 
								 | 
							
								    });
							 | 
						||
| 
								 | 
							
								    it('returns correct url when user gives admin root path not starting with /', function () {
							 | 
						||
| 
								 | 
							
								      const h = new _viewHelpers.default({
							 | 
						||
| 
								 | 
							
								        options: {
							 | 
						||
| 
								 | 
							
								          rootPath: 'admin'
							 | 
						||
| 
								 | 
							
								        }
							 | 
						||
| 
								 | 
							
								      });
							 | 
						||
| 
								 | 
							
								      (0, _chai.expect)(h.urlBuilder(['my', 'path'])).to.equal('/admin/my/path');
							 | 
						||
| 
								 | 
							
								    });
							 | 
						||
| 
								 | 
							
								    it('returns correct url for rootPath set to /', function () {
							 | 
						||
| 
								 | 
							
								      const h = new _viewHelpers.default({
							 | 
						||
| 
								 | 
							
								        options: {
							 | 
						||
| 
								 | 
							
								          rootPath: '/'
							 | 
						||
| 
								 | 
							
								        }
							 | 
						||
| 
								 | 
							
								      });
							 | 
						||
| 
								 | 
							
								      (0, _chai.expect)(h.urlBuilder(['my', 'path'])).to.equal('/my/path');
							 | 
						||
| 
								 | 
							
								    });
							 | 
						||
| 
								 | 
							
								  });
							 | 
						||
| 
								 | 
							
								});
							 |