Browse Source

Several tests added

master
Leo Lamprecht 7 years ago
parent
commit
d0562dd3bf
  1. 2081
      package-lock.json
  2. 14
      package.json
  3. 49
      test/_fixtures/big-file/big.js
  4. 6
      test/_fixtures/big-file/package.json
  5. 14
      test/_fixtures/big-file/small-two.js
  6. 1
      test/_fixtures/big-file/small.js
  7. 0
      test/_fixtures/directory-main/a/index.js
  8. 0
      test/_fixtures/directory-main/build/a.js
  9. 7
      test/_fixtures/directory-main/package.json
  10. 1
      test/_fixtures/dockerfile/Dockerfile
  11. 1
      test/_fixtures/dockerfile/a.js
  12. 0
      test/_fixtures/extensionless-main/build/a.js
  13. 0
      test/_fixtures/extensionless-main/index.js
  14. 7
      test/_fixtures/extensionless-main/package.json
  15. 0
      test/_fixtures/files-in-package-ignore/.a.swp
  16. 2
      test/_fixtures/files-in-package-ignore/.npmignore
  17. 0
      test/_fixtures/files-in-package-ignore/README
  18. 0
      test/_fixtures/files-in-package-ignore/build/a/b/c/d.js
  19. 0
      test/_fixtures/files-in-package-ignore/build/a/e.js
  20. 0
      test/_fixtures/files-in-package-ignore/build/a/should-be-excluded.js
  21. 5
      test/_fixtures/files-in-package-ignore/package.json
  22. 0
      test/_fixtures/files-in-package-ignore/should-be-excluded.js
  23. 0
      test/_fixtures/files-in-package/build/a/b/c/d.js
  24. 0
      test/_fixtures/files-in-package/build/a/e.js
  25. 5
      test/_fixtures/files-in-package/package.json
  26. 0
      test/_fixtures/files-in-package/should-be-excluded.js
  27. 2
      test/_fixtures/files-overrides-gitignore/.gitignore
  28. 6
      test/_fixtures/files-overrides-gitignore/package.json
  29. 1
      test/_fixtures/files-overrides-gitignore/test.js
  30. BIN
      test/_fixtures/hashes/dei.png
  31. BIN
      test/_fixtures/hashes/duplicate/dei.png
  32. 1
      test/_fixtures/hashes/index.js
  33. 6
      test/_fixtures/hashes/package.json
  34. 1
      test/_fixtures/multiple-manifests-throws/Dockerfile
  35. 3
      test/_fixtures/multiple-manifests-throws/package.json
  36. 1
      test/_fixtures/negation/a.js
  37. 8
      test/_fixtures/negation/package.json
  38. 1
      test/_fixtures/nested-node_modules/.npmignore
  39. 1
      test/_fixtures/nested-node_modules/index.js
  40. 3
      test/_fixtures/nested-node_modules/package.json
  41. 1
      test/_fixtures/no-node_modules/index.js
  42. 6
      test/_fixtures/no-node_modules/package.json
  43. 2
      test/_fixtures/now-files-overrides-npmignore/.npmignore
  44. 1
      test/_fixtures/now-files-overrides-npmignore/ignore-me.js
  45. 8
      test/_fixtures/now-files-overrides-npmignore/package.json
  46. 1
      test/_fixtures/now-files-overrides-npmignore/test.js
  47. 1
      test/_fixtures/now-files-overrides-npmignore/test.json
  48. 1
      test/_fixtures/now-files/a.js
  49. 1
      test/_fixtures/now-files/b.js
  50. 14
      test/_fixtures/now-files/package.json
  51. 1
      test/_fixtures/now-json-docker/Dockerfile
  52. 1
      test/_fixtures/now-json-docker/a.js
  53. 1
      test/_fixtures/now-json-docker/b.js
  54. 5
      test/_fixtures/now-json-docker/now.json
  55. 3
      test/_fixtures/now-json-throws/now.json
  56. 9
      test/_fixtures/now-json-throws/package.json
  57. 1
      test/_fixtures/now-json/a.js
  58. 1
      test/_fixtures/now-json/b.js
  59. 5
      test/_fixtures/now-json/now.json
  60. 9
      test/_fixtures/now-json/package.json
  61. 1
      test/_fixtures/prefix-regression/.npmignore
  62. 6
      test/_fixtures/prefix-regression/package.json
  63. 1
      test/_fixtures/prefix-regression/woot.js
  64. 0
      test/_fixtures/simple-main/build/a.js
  65. 0
      test/_fixtures/simple-main/index.js
  66. 7
      test/_fixtures/simple-main/package.json
  67. 0
      test/_fixtures/simple/bin/test
  68. 0
      test/_fixtures/simple/index.js
  69. 0
      test/_fixtures/simple/lib/woot
  70. 0
      test/_fixtures/simple/lib/woot.jsx
  71. 3
      test/_fixtures/simple/package.json
  72. 1
      test/_fixtures/type-in-package-now-with-dockerfile/Dockerfile
  73. 5
      test/_fixtures/type-in-package-now-with-dockerfile/package.json
  74. 240
      test/index.js
  75. 62
      test/pack-now.js
  76. 38
      test/to-host.js

2081
package-lock.json

File diff suppressed because it is too large

14
package.json

@ -5,7 +5,8 @@
"description": "The command line interface for Now",
"repository": "zeit/now-cli",
"scripts": {
"test": "eslint .",
"test": "ava",
"lint": "eslint .",
"prepublishOnly": "npm run build-download && cp /dev/null download/dist/now",
"dev": "webpack -w",
"precommit": "lint-staged",
@ -19,7 +20,7 @@
},
"lint-staged": {
"*.js": [
"eslint",
"npm run lint",
"prettier --write --single-quote --no-semi",
"git add"
]
@ -42,6 +43,12 @@
"node7-win-x64"
]
},
"ava": {
"failFast": true,
"files": [
"test/*.js"
]
},
"eslintIgnore": [
"download",
"dist"
@ -78,11 +85,13 @@
},
"devDependencies": {
"@google/maps": "0.4.3",
"alpha-sort": "2.0.1",
"ansi-escapes": "2.0.0",
"archiver": "2.0.3",
"arr-flatten": "1.1.0",
"array-unique": "0.3.2",
"async-retry": "1.1.3",
"ava": "0.22.0",
"aws-sdk": "2.108.0",
"babel-core": "6.26.0",
"babel-eslint": "7.2.3",
@ -98,6 +107,7 @@
"convert-stream": "1.0.2",
"copy-webpack-plugin": "4.0.1",
"credit-card": "3.0.1",
"cross-spawn": "5.1.0",
"dateformat": "2.0.0",
"death": "1.1.0",
"debug": "3.0.1",

49
test/_fixtures/big-file/big.js

@ -0,0 +1,49 @@
woot
woot
woot
woot
woot
woot
woot
woot
woot
woot
woot
woot
woot
woot
woot
woot
woot
woot
woot
woot
woot
woot
woot
woot
woot
woot
woot
woot
woot
woot
woot
woot
woot
woot
woot
woot
woot
woot
woot
woot
woot
woot
woot
woot
woot
woot
woot
woot
woot

6
test/_fixtures/big-file/package.json

@ -0,0 +1,6 @@
{
"name": "",
"version": "0.0.1",
"description": "",
"dependencies": {}
}

14
test/_fixtures/big-file/small-two.js

@ -0,0 +1,14 @@
woot
woot
woot
woot
woot
woot
woot
woot
woot
woot
woot
woot
woot
woot

1
test/_fixtures/big-file/small.js

@ -0,0 +1 @@
woot

0
test/_fixtures/directory-main/a/index.js

0
test/_fixtures/directory-main/build/a.js

7
test/_fixtures/directory-main/package.json

@ -0,0 +1,7 @@
{
"name": "directory-main",
"version": "0.0.1",
"description": "",
"main": "./a",
"dependencies": {}
}

1
test/_fixtures/dockerfile/Dockerfile

@ -0,0 +1 @@
CMD echo 'world'

1
test/_fixtures/dockerfile/a.js

@ -0,0 +1 @@
// this should be included

0
test/_fixtures/extensionless-main/build/a.js

0
test/_fixtures/extensionless-main/index.js

7
test/_fixtures/extensionless-main/package.json

@ -0,0 +1,7 @@
{
"name": "extensionless-main",
"version": "0.0.1",
"description": "",
"main": "./index",
"dependencies": {}
}

0
test/_fixtures/files-in-package-ignore/.a.swp

2
test/_fixtures/files-in-package-ignore/.npmignore

@ -0,0 +1,2 @@
should-be-excluded.js
./build/a/should-be-excluded.js

0
test/_fixtures/files-in-package-ignore/README

0
test/_fixtures/files-in-package-ignore/build/a/b/c/d.js

0
test/_fixtures/files-in-package-ignore/build/a/e.js

0
test/_fixtures/files-in-package-ignore/build/a/should-be-excluded.js

5
test/_fixtures/files-in-package-ignore/package.json

@ -0,0 +1,5 @@
{
"files": [
"build"
]
}

0
test/_fixtures/files-in-package-ignore/should-be-excluded.js

0
test/_fixtures/files-in-package/build/a/b/c/d.js

0
test/_fixtures/files-in-package/build/a/e.js

5
test/_fixtures/files-in-package/package.json

@ -0,0 +1,5 @@
{
"files": [
"build"
]
}

0
test/_fixtures/files-in-package/should-be-excluded.js

2
test/_fixtures/files-overrides-gitignore/.gitignore

@ -0,0 +1,2 @@
ignore-me.js
test.json

6
test/_fixtures/files-overrides-gitignore/package.json

@ -0,0 +1,6 @@
{
"files": [
"test.js",
"test.json"
]
}

1
test/_fixtures/files-overrides-gitignore/test.js

@ -0,0 +1 @@
// include me

BIN
test/_fixtures/hashes/dei.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 167 KiB

BIN
test/_fixtures/hashes/duplicate/dei.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 167 KiB

1
test/_fixtures/hashes/index.js

@ -0,0 +1 @@
woot

6
test/_fixtures/hashes/package.json

@ -0,0 +1,6 @@
{
"name": "hashes",
"version": "0.0.1",
"description": "",
"dependencies": {}
}

1
test/_fixtures/multiple-manifests-throws/Dockerfile

@ -0,0 +1 @@
CMD echo 'world'

3
test/_fixtures/multiple-manifests-throws/package.json

@ -0,0 +1,3 @@
{
"name": "simple"
}

1
test/_fixtures/negation/a.js

@ -0,0 +1 @@
// should include it

8
test/_fixtures/negation/package.json

@ -0,0 +1,8 @@
{
"name": "negation",
"version": "0.0.1",
"description": "",
"dependencies": {
}
}

1
test/_fixtures/nested-node_modules/.npmignore

@ -0,0 +1 @@
**/node_modules

1
test/_fixtures/nested-node_modules/index.js

@ -0,0 +1 @@
// this should be included

3
test/_fixtures/nested-node_modules/package.json

@ -0,0 +1,3 @@
{
"name": "nested-node_modules"
}

1
test/_fixtures/no-node_modules/index.js

@ -0,0 +1 @@
console.log('index');

6
test/_fixtures/no-node_modules/package.json

@ -0,0 +1,6 @@
{
"name": "no-node_modules",
"version": "0.0.1",
"description": "",
"dependencies": {}
}

2
test/_fixtures/now-files-overrides-npmignore/.npmignore

@ -0,0 +1,2 @@
ignore-me.js
test.json

1
test/_fixtures/now-files-overrides-npmignore/ignore-me.js

@ -0,0 +1 @@
// this should be ignored

8
test/_fixtures/now-files-overrides-npmignore/package.json

@ -0,0 +1,8 @@
{
"now": {
"files": [
"test.js",
"test.json"
]
}
}

1
test/_fixtures/now-files-overrides-npmignore/test.js

@ -0,0 +1 @@
// include me

1
test/_fixtures/now-files-overrides-npmignore/test.json

@ -0,0 +1 @@
{ "include": "me" }

1
test/_fixtures/now-files/a.js

@ -0,0 +1 @@
// should not be included

1
test/_fixtures/now-files/b.js

@ -0,0 +1 @@
// should be included

14
test/_fixtures/now-files/package.json

@ -0,0 +1,14 @@
{
"name": "woot",
"version": "0.0.1",
"description": "",
"dependencies": {},
"files": [
"a.js"
],
"now": {
"files": [
"b.js"
]
}
}

1
test/_fixtures/now-json-docker/Dockerfile

@ -0,0 +1 @@
CMD echo 'world'

1
test/_fixtures/now-json-docker/a.js

@ -0,0 +1 @@
// should not be included

1
test/_fixtures/now-json-docker/b.js

@ -0,0 +1 @@
// should be included

5
test/_fixtures/now-json-docker/now.json

@ -0,0 +1,5 @@
{
"files": [
"b.js"
]
}

3
test/_fixtures/now-json-throws/now.json

@ -0,0 +1,3 @@
{
"alias": "bar.com"
}

9
test/_fixtures/now-json-throws/package.json

@ -0,0 +1,9 @@
{
"name": "woot",
"version": "0.0.1",
"description": "",
"dependencies": {},
"now": {
"alias": "foo.com"
}
}

1
test/_fixtures/now-json/a.js

@ -0,0 +1 @@
// should not be included

1
test/_fixtures/now-json/b.js

@ -0,0 +1 @@
// should be included

5
test/_fixtures/now-json/now.json

@ -0,0 +1,5 @@
{
"files": [
"b.js"
]
}

9
test/_fixtures/now-json/package.json

@ -0,0 +1,9 @@
{
"name": "woot",
"version": "0.0.1",
"description": "",
"dependencies": {},
"files": [
"a.js"
]
}

1
test/_fixtures/prefix-regression/.npmignore

@ -0,0 +1 @@
woot

6
test/_fixtures/prefix-regression/package.json

@ -0,0 +1,6 @@
{
"name": "prefix-regression",
"version": "0.0.1",
"description": "",
"dependencies": {}
}

1
test/_fixtures/prefix-regression/woot.js

@ -0,0 +1 @@
// hello

0
test/_fixtures/simple-main/build/a.js

0
test/_fixtures/simple-main/index.js

7
test/_fixtures/simple-main/package.json

@ -0,0 +1,7 @@
{
"name": "simple-with-main",
"version": "0.0.1",
"description": "",
"main": "./index.js",
"dependencies": {}
}

0
test/_fixtures/simple/bin/test

0
test/_fixtures/simple/index.js

0
test/_fixtures/simple/lib/woot

0
test/_fixtures/simple/lib/woot.jsx

3
test/_fixtures/simple/package.json

@ -0,0 +1,3 @@
{
"name": "simple"
}

1
test/_fixtures/type-in-package-now-with-dockerfile/Dockerfile

@ -0,0 +1 @@
CMD echo 'world'

5
test/_fixtures/type-in-package-now-with-dockerfile/package.json

@ -0,0 +1,5 @@
{
"now": {
"type": "npm"
}
}

240
test/index.js

@ -0,0 +1,240 @@
// Native
const { join, resolve } = require('path')
// Packages
const test = require('ava')
const { asc: alpha } = require('alpha-sort')
// Utilities
const hash = require('../src/providers/sh/util/hash')
const readMetadata = require('../src/providers/sh/util/read-metadata')
const {
npm: getNpmFiles_,
docker: getDockerFiles
} = require('../src/providers/sh/util/get-files')
const prefix = join(__dirname, '_fixtures') + '/'
const base = path => path.replace(prefix, '')
const fixture = name => resolve(`./test/_fixtures/${name}`)
// Overload to force debugging
const getNpmFiles = async dir => {
const { pkg, nowConfig, hasNowJson } = await readMetadata(dir, {
quiet: true,
strict: false
})
return getNpmFiles_(dir, pkg, nowConfig, { hasNowJson })
}
test('`files`', async t => {
let files = await getNpmFiles(fixture('files-in-package'))
t.is(files.length, 3)
files = files.sort(alpha)
t.is(base(files[0]), 'files-in-package/build/a/b/c/d.js')
t.is(base(files[1]), 'files-in-package/build/a/e.js')
t.is(base(files[2]), 'files-in-package/package.json')
})
test('`files` + `.*.swp` + `.npmignore`', async t => {
let files = await getNpmFiles(fixture('files-in-package-ignore'))
files = files.sort(alpha)
t.is(files.length, 3)
t.is(base(files[0]), 'files-in-package-ignore/build/a/b/c/d.js')
t.is(base(files[1]), 'files-in-package-ignore/build/a/e.js')
t.is(base(files[2]), 'files-in-package-ignore/package.json')
})
test('`files` overrides `.gitignore`', async t => {
let files = await getNpmFiles(fixture('files-overrides-gitignore'))
files = files.sort(alpha)
t.is(files.length, 3)
t.is(base(files[0]), 'files-overrides-gitignore/package.json')
t.is(base(files[1]), 'files-overrides-gitignore/test.js')
t.is(base(files[2]), 'files-overrides-gitignore/test.json')
})
test('`now.files` overrides `.npmignore`', async t => {
let files = await getNpmFiles(fixture('now-files-overrides-npmignore'))
files = files.sort(alpha)
t.is(files.length, 3)
t.is(base(files[0]), 'now-files-overrides-npmignore/package.json')
t.is(base(files[1]), 'now-files-overrides-npmignore/test.js')
t.is(base(files[2]), 'now-files-overrides-npmignore/test.json')
})
test('simple', async t => {
let files = await getNpmFiles(fixture('simple'))
files = files.sort(alpha)
t.is(files.length, 5)
t.is(base(files[0]), 'simple/bin/test')
t.is(base(files[1]), 'simple/index.js')
t.is(base(files[2]), 'simple/lib/woot')
t.is(base(files[3]), 'simple/lib/woot.jsx')
t.is(base(files[4]), 'simple/package.json')
})
test('simple with main', async t => {
let files = await getNpmFiles(fixture('simple-main'))
t.is(files.length, 3)
files = files.sort(alpha)
t.is(files.length, 3)
t.is(base(files[0]), 'simple-main/build/a.js')
t.is(base(files[1]), 'simple-main/index.js')
t.is(base(files[2]), 'simple-main/package.json')
})
test('directory main', async t => {
let files = await getNpmFiles(fixture('directory-main'))
t.is(files.length, 3)
files = files.sort(alpha)
t.is(files.length, 3)
t.is(base(files[0]), 'directory-main/a/index.js')
t.is(base(files[1]), 'directory-main/build/a.js')
t.is(base(files[2]), 'directory-main/package.json')
})
test('extensionless main', async t => {
let files = await getNpmFiles(fixture('extensionless-main'))
t.is(files.length, 3)
files = files.sort(alpha)
t.is(files.length, 3)
t.is(base(files[0]), 'extensionless-main/build/a.js')
t.is(base(files[1]), 'extensionless-main/index.js')
t.is(base(files[2]), 'extensionless-main/package.json')
})
test('hashes', async t => {
const files = await getNpmFiles(fixture('hashes'))
const hashes = await hash(files)
t.is(hashes.size, 3)
const many = new Set(
hashes.get('277c55a2042910b9fe706ad00859e008c1b7d172').names
)
t.is(many.size, 2)
t.is(many.has(prefix + 'hashes/dei.png'), true)
t.is(many.has(prefix + 'hashes/duplicate/dei.png'), true)
t.is(
hashes.get('56c00d0466fc6bdd41b13dac5fc920cc30a63b45').names[0],
prefix + 'hashes/index.js'
)
t.is(
hashes.get('706214f42ae940a01d2aa60c5e32408f4d2127dd').names[0],
prefix + 'hashes/package.json'
)
})
test('ignore node_modules', async t => {
let files = await getNpmFiles(fixture('no-node_modules'))
files = files.sort(alpha)
t.is(files.length, 2)
t.is(base(files[0]), 'no-node_modules/index.js')
t.is(base(files[1]), 'no-node_modules/package.json')
})
test('ignore nested `node_modules` with .npmignore **', async t => {
let files = await getNpmFiles(fixture('nested-node_modules'))
files = files.sort(alpha)
t.is(files.length, 2)
t.is(base(files[0]), 'nested-node_modules/index.js')
t.is(base(files[1]), 'nested-node_modules/package.json')
})
test('support whitelisting with .npmignore and !', async t => {
let files = await getNpmFiles(fixture('negation'))
files = files.sort(alpha)
t.is(files.length, 2)
t.is(base(files[0]), 'negation/a.js')
t.is(base(files[1]), 'negation/package.json')
})
test('support `now.files`', async t => {
let files = await getNpmFiles(fixture('now-files'))
files = files.sort(alpha)
t.is(files.length, 2)
t.is(base(files[0]), 'now-files/b.js')
t.is(base(files[1]), 'now-files/package.json')
})
test('support docker', async t => {
let files = await getDockerFiles(fixture('dockerfile'))
files = files.sort(alpha)
t.is(files.length, 2)
t.is(base(files[0]), 'dockerfile/Dockerfile')
t.is(base(files[1]), 'dockerfile/a.js')
})
test('prefix regression', async t => {
let files = await getNpmFiles(fixture('prefix-regression'))
files = files.sort(alpha)
t.is(files.length, 2)
t.is(base(files[0]), 'prefix-regression/package.json')
t.is(base(files[1]), 'prefix-regression/woot.js')
})
test('support `now.json` files with package.json', async t => {
let files = await getNpmFiles(fixture('now-json'))
files = files.sort(alpha)
t.is(files.length, 3)
t.is(base(files[0]), 'now-json/b.js')
t.is(base(files[1]), 'now-json/now.json')
t.is(base(files[2]), 'now-json/package.json')
})
test('support `now.json` files with Dockerfile', async t => {
const f = fixture('now-json-docker')
const { deploymentType, nowConfig, hasNowJson } = await readMetadata(f, {
quiet: true,
strict: false
})
t.is(deploymentType, 'docker')
let files = await getDockerFiles(f, nowConfig, { hasNowJson })
files = files.sort(alpha)
t.is(files.length, 3)
t.is(base(files[0]), 'now-json-docker/Dockerfile')
t.is(base(files[1]), 'now-json-docker/b.js')
t.is(base(files[2]), 'now-json-docker/now.json')
})
test('throws when both `now.json` and `package.json:now` exist', async t => {
let e
try {
await readMetadata(fixture('now-json-throws'), {
quiet: true,
strict: false
})
} catch (err) {
e = err
}
t.is(e.name, 'Error')
t.is(e.userError, true)
t.pass(
/please ensure there's a single source of configuration/i.test(e.message)
)
})
test('throws when `package.json` and `Dockerfile` exist', async t => {
let e
try {
await readMetadata(fixture('multiple-manifests-throws'), {
quiet: true,
strict: false
})
} catch (err) {
e = err
}
t.is(e.userError, true)
t.is(e.code, 'MULTIPLE_MANIFESTS')
t.pass(/ambiguous deployment/i.test(e.message))
})
test('support `package.json:now.type` to bypass multiple manifests error', async t => {
const f = fixture('type-in-package-now-with-dockerfile')
const { type, nowConfig, hasNowJson } = await readMetadata(f, {
quiet: true,
strict: false
})
t.is(type, 'npm')
t.is(nowConfig.type, 'npm')
t.is(hasNowJson, false)
})

62
test/pack-now.js

@ -0,0 +1,62 @@
// Native
const path = require('path')
// Packages
const crossSpawn = require('cross-spawn')
const test = require('ava')
// Utilities
const logo = require('../src/util/output/logo')
test.serial('make binary', async t => {
if (!process.env.CI) {
t.true(true)
return
}
const result = await spawn('npm', ['run', 'pack'])
t.is(result.code, 0)
})
const binary = {
darwin: 'now-macos',
linux: 'now-linux',
win32: 'now-win.exe'
}[process.platform]
const binaryPath = path.resolve(__dirname, '../packed/' + binary)
const deployHelpMessage = `${logo} now [options] <command | path>`
test.serial('packed "now help" prints deploy help message', async t => {
if (!process.env.CI) {
t.true(true)
return
}
const result = await spawn(binaryPath, ['help'])
t.is(result.code, 0)
const stdout = result.stdout.split('\n')
t.true(stdout.length > 1)
t.true(stdout[1].includes(deployHelpMessage))
})
function spawn(command, args) {
return new Promise((resolve, reject) => {
const child = crossSpawn.spawn(command, args)
let stdout = ''
child.stdout.on('data', data => {
stdout += data
})
child.on('error', err => {
reject(err)
})
child.on('close', code => {
resolve({
code,
stdout
})
})
})
}

38
test/to-host.js

@ -0,0 +1,38 @@
// Packages
const test = require('ava')
// Utilities
const toHost = require('../src/providers/sh/util/to-host')
test('simple', t => {
t.is(toHost('zeit.co'), 'zeit.co')
})
test('leading //', t => {
t.is(toHost('//zeit-logos-rnemgaicnc.now.sh'), 'zeit-logos-rnemgaicnc.now.sh')
})
test('leading http://', t => {
t.is(
toHost('http://zeit-logos-rnemgaicnc.now.sh'),
'zeit-logos-rnemgaicnc.now.sh'
)
})
test('leading https://', t => {
t.is(
toHost('https://zeit-logos-rnemgaicnc.now.sh'),
'zeit-logos-rnemgaicnc.now.sh'
)
})
test('leading https:// and path', t => {
t.is(
toHost('https://zeit-logos-rnemgaicnc.now.sh/path'),
'zeit-logos-rnemgaicnc.now.sh'
)
})
test('simple and path', t => {
t.is(toHost('zeit.co/test'), 'zeit.co')
})
Loading…
Cancel
Save