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

chai-string

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chai-string

strings comparison matchers for chai

  • 1.5.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
404K
decreased by-3.04%
Maintainers
1
Weekly downloads
 
Created

What is chai-string?

chai-string is an extension for the Chai assertion library that provides a set of string-specific assertions. It allows developers to write more readable and expressive tests for string values.

What are chai-string's main functionalities?

startsWith

Asserts that a string starts with a given substring.

const chai = require('chai');
const chaiString = require('chai-string');
chai.use(chaiString);
const expect = chai.expect;

expect('Hello, world!').to.startWith('Hello');

endsWith

Asserts that a string ends with a given substring.

const chai = require('chai');
const chaiString = require('chai-string');
chai.use(chaiString);
const expect = chai.expect;

expect('Hello, world!').to.endWith('world!');

contains

Asserts that a string contains a given substring.

const chai = require('chai');
const chaiString = require('chai-string');
chai.use(chaiString);
const expect = chai.expect;

expect('Hello, world!').to.contain('world');

equalIgnoreCase

Asserts that two strings are equal, ignoring case.

const chai = require('chai');
const chaiString = require('chai-string');
chai.use(chaiString);
const expect = chai.expect;

expect('Hello').to.equalIgnoreCase('hello');

singleLine

Asserts that a string is a single line (i.e., does not contain newline characters).

const chai = require('chai');
const chaiString = require('chai-string');
chai.use(chaiString);
const expect = chai.expect;

expect('Hello, world!').to.be.singleLine;

Other packages similar to chai-string

Keywords

FAQs

Package last updated on 01 Sep 2018

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