UNPKG

@zendesk/zcli-themes

Version:

zcli theme commands live here

55 lines (54 loc) 1.97 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const test_1 = require("@oclif/test"); const getLocalServerBaseUrl_1 = require("./getLocalServerBaseUrl"); describe('getLocalServerBaseUrl', () => { it('should return correct http url', () => { const flags = { bind: 'localhost', port: 4567, logs: false, livereload: true }; const result = (0, getLocalServerBaseUrl_1.getLocalServerBaseUrl)(flags); const expected = 'http://localhost:4567'; (0, test_1.expect)(result).to.equal(expected); }); it('should return correct https url', () => { const flags = { bind: 'themes.local', port: 4567, logs: false, livereload: true, 'https-cert': 'localhost.crt', 'https-key': 'localhost.key' }; const result = (0, getLocalServerBaseUrl_1.getLocalServerBaseUrl)(flags); const expected = 'https://themes.local:4567'; (0, test_1.expect)(result).to.equal(expected); }); it('should return correct ws url', () => { const flags = { bind: 'localhost', port: 4567, logs: false, livereload: true }; const result = (0, getLocalServerBaseUrl_1.getLocalServerBaseUrl)(flags, true); const expected = 'ws://localhost:4567'; (0, test_1.expect)(result).to.equal(expected); }); it('should return correct wss url', () => { const flags = { bind: 'themes.local', port: 4567, logs: false, livereload: true, 'https-cert': 'localhost.crt', 'https-key': 'localhost.key' }; const result = (0, getLocalServerBaseUrl_1.getLocalServerBaseUrl)(flags, true); const expected = 'wss://themes.local:4567'; (0, test_1.expect)(result).to.equal(expected); }); });