Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

chai-url

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chai-url

A chai assertion plugin for working with urls

  • 1.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

chai-url

A chai assertion plugin for working with urls

Provides a number of assertion helpers for working with urls.

Usage

const chai = require('chai');
chai.use(require('chai-url'));

chai.expect('http://example.com/foo/bar').to.have.path('/foo/bar');
chai.expect('http://example.com/foo/bar').to.have.protocol('http');

Available matchers

  • path
  • pathname
  • port
  • hostname
  • protocol
  • auth
  • hash

In each case, the property is tested against the corresponding property from node's url.parse method.

In the case of hash and protocol properties which may be prefixed/suffixed with # and : respectively these characters are optional and will match with or without their presence.

Partial matching

The path, pathname, hostname, auth and hash functions can also perform partial matching based on substrings by using a contains clause in the test statement.

expect('http://example.com/foo/bar').to.contain.path('/foo');

Examples

See the tests for this module for further examples.

Keywords

FAQs

Package last updated on 02 Mar 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc