OverviewFilesCommitsIssuesDocsReleasesPeers

pear-git / test / unit / app-archive-install.test.js

28 lines · javascript ref:
/**
 * Unit tests for HTTP archive install in pgh app install
 *
 * Tests the buildArchiveUrl helper exported from lib/cli/commands/app.js
 */

import test from 'brittle'
import { buildArchiveUrl } from '../../lib/cli/commands/app.js'

// ========================================
// buildArchiveUrl
// ========================================

test('buildArchiveUrl - constructs correct URL', (t) => {
  t.is(buildArchiveUrl('http://localhost:5005/git', 'hypernote'),
    'http://localhost:5005/git/tabertron/hypernote/archive/release.tar.gz')
})

test('buildArchiveUrl - strips trailing slash', (t) => {
  t.is(buildArchiveUrl('http://localhost:5005/git/', 'my-app'),
    'http://localhost:5005/git/tabertron/my-app/archive/release.tar.gz')
})

test('buildArchiveUrl - works without prefix', (t) => {
  t.is(buildArchiveUrl('http://localhost:5005', 'my-app'),
    'http://localhost:5005/tabertron/my-app/archive/release.tar.gz')
})