DefinitelyTyped/types/chai-string/index.d.ts
Rebecca Turner 12453a8fe1 [chai] Provide type definitions for chai.use (#37451)
* chai: Add types for chai.use and chai.util

Helps developers write Chai plugins; requested in #29922.

Closes #29922.

* Updated dependencies on Chai

- Minimum TS version: 3.0
    - Version bumps to TS 3.0 for the following type definitions which
      depend on chai directly or indirectly:
            bardjs, chai, chai-almost, chai-arrays, chai-as-promised,
            chai-datetime, chai-dom, chai-enzyme, chai-fs, chai-fuzzy,
            chai-jest-snapshot, chai-jquery, chai-json-schema,
            chai-moment, chai-oequal, chai-roughly, chai-spies,
            chai-string, chai-subset, chai-things, chai-uuid,
            chai-webdriverio, chai-xml, d3kit, deep-equal-in-any-order,
            dirty-chai, ember-mocha, hexo, hexo-log, hexo-util,
            jsx-chai, karma-chai, karma-chai-sinon, redux-test-utils,
            and sinon-chai
- Use Chai.ChaiPlugin instead of (chai: any, utils: any) => void

* Factor out pathval types

- Forgot that the pathval types aren't merged yet

* Factor out pathval types

- Forgot that the pathval types aren't merged yet

* Make 'chainingBehavior' non-mandatory
2019-08-08 08:58:47 -07:00

55 lines
2.9 KiB
TypeScript

// Type definitions for chai-string 1.4.0
// Project: https://github.com/onechiporenko/chai-string
// Definitions by: Nick Malaguti <https://github.com/nmalaguti>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.0
///<reference types="chai" />
declare global {
namespace Chai {
interface Assertion extends LanguageChains, NumericComparison, TypeComparison {
startsWith(expected: string, message?: string): Assertion;
startWith(expected: string, message?: string): Assertion;
endsWith(expected: string, message?: string): Assertion;
endWith(expected: string, message?: string): Assertion;
equalIgnoreCase(expected: string, message?: string): Assertion;
equalIgnoreSpaces(expected: string, message?: string): Assertion;
containIgnoreCase(expected: string, msg?: string): Assertion;
containIgnoreSpaces(expected: string, msg?: string): Assertion;
singleLine(message?: string): Assertion;
reverseOf(message?: string): Assertion;
palindrome(message?: string): Assertion;
entriesCount(substr: string, expected: number, message?: string): Assertion;
indexOf(str: string, substr: string, index: number, msg?: string): Assertion;
}
interface Assert {
startsWith(val: string, exp: string, msg?: string): void;
notStartsWith(val: string, exp: string, msg?: string): void;
endsWith(val: string, exp: string, msg?: string): void;
notEndsWith(val: string, exp: string, msg?: string): void;
equalIgnoreCase(val: string, exp: string, msg?: string): void;
notEqualIgnoreCase(val: string, exp: string, msg?: string): void;
equalIgnoreSpaces(val: string, exp: string, msg?: string): void;
notEqualIgnoreSpaces(val: string, exp: string, msg?: string): void;
containIgnoreCase(val: string, exp: string, msg?: string): void;
notContainIgnoreCase(val: string, exp: string, msg?: string): void;
containIgnoreSpaces(val: string, exp: string, msg?: string): void;
notContainIgnoreSpaces(val: string, exp: string, msg?: string): void;
singleLine(val: string, msg?: string): void;
notSingleLine(val: string, msg?: string): void;
reverseOf(val: string, exp: string, msg?: string): void;
notReverseOf(val: string, exp: string, msg?: string): void;
palindrome(val: string, msg?: string): void;
notPalindrome(val: string, msg?: string): void;
entriesCount(str: string, substr: string, count: number, msg?: string): void;
indexOf(str: string, substr: string, index: number, msg?: string): void;
}
}
}
declare const chaiString: Chai.ChaiPlugin;
declare namespace chaiString { }
export = chaiString;