mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-05-29 15:44:31 +00:00
should: Provides its own types
This commit is contained in:
@@ -696,6 +696,12 @@
|
||||
"sourceRepoURL": "https://github.com/nozzlegear/shopify-prime",
|
||||
"asOfVersion": "2.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "should.js",
|
||||
"typingsPackageName": "should",
|
||||
"sourceRepoURL": "https://github.com/shouldjs/should.js",
|
||||
"asOfVersion": "13.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "SimpleSignal",
|
||||
"typingsPackageName": "simplesignal",
|
||||
|
||||
@@ -1,14 +1,30 @@
|
||||
/// <reference types="mocha" />
|
||||
/// <reference types="should" />
|
||||
|
||||
import gulp = require('gulp');
|
||||
import util = require('gulp-util');
|
||||
import path = require('path');
|
||||
import should = require('should');
|
||||
import Stream = require('stream');
|
||||
import through = require('through2');
|
||||
const es = require('event-stream');
|
||||
//TODO: import es = require('event-stream');
|
||||
|
||||
// TODO: These aren't useful as types tests since they take `any`.
|
||||
declare const should: ShouldStatic;
|
||||
interface ShouldStatic {
|
||||
exist(obj: any, desc?: string): void;
|
||||
not: this;
|
||||
}
|
||||
interface Should {
|
||||
// tslint:disable-next-line ban-types
|
||||
be: { instanceof(cls: Function): void; type(name: string): void; false: undefined; true: undefined; };
|
||||
equal(obj: any): void;
|
||||
eql(obj: any): void;
|
||||
not: this;
|
||||
}
|
||||
declare global {
|
||||
interface Object {
|
||||
should: Should;
|
||||
}
|
||||
}
|
||||
|
||||
// ReSharper disable WrongExpressionStatement
|
||||
describe('File()', () => {
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"comment-format": false, // TODO
|
||||
"no-reference-import": false, // TODO: fix "should"
|
||||
"no-var-requires": false // TODO
|
||||
}
|
||||
}
|
||||
|
||||
8
types/should-promised/index.d.ts
vendored
8
types/should-promised/index.d.ts
vendored
@@ -1,8 +0,0 @@
|
||||
// Type definitions for should-promised
|
||||
// Project: https://github.com/shouldjs/promised
|
||||
// Definitions by: Yaroslav Admin <https://github.com/devoto13>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
interface ShouldAssertion {
|
||||
// all of the extensions are now part of should itself
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
/// <reference types="should" />
|
||||
|
||||
|
||||
var promise: Promise<number> = new Promise<number>(function (resolve, reject) {});
|
||||
|
||||
promise.should.be.Promise;
|
||||
(10).should.not.be.a.Promise;
|
||||
|
||||
promise.should.be.fulfilled();
|
||||
|
||||
promise.should.be.rejected();
|
||||
|
||||
promise.should.be.rejectedWith(Error);
|
||||
promise.should.be.rejectedWith('boom');
|
||||
promise.should.be.rejectedWith(/boom/);
|
||||
promise.should.be.rejectedWith(Error, { message: 'boom' });
|
||||
promise.should.be.rejectedWith({ message: 'boom' });
|
||||
|
||||
promise.should.be.eventually.equal(10);
|
||||
promise.should.be.finally.equal(10);
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"should-promised-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"adjacent-overload-signatures": false,
|
||||
"array-type": false,
|
||||
"arrow-return-shorthand": false,
|
||||
"ban-types": false,
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"eofline": false,
|
||||
"export-just-namespace": false,
|
||||
"import-spacing": false,
|
||||
"interface-name": false,
|
||||
"interface-over-type-literal": false,
|
||||
"jsdoc-format": false,
|
||||
"max-line-length": false,
|
||||
"member-access": false,
|
||||
"new-parens": false,
|
||||
"no-any-union": false,
|
||||
"no-boolean-literal-compare": false,
|
||||
"no-conditional-assignment": false,
|
||||
"no-consecutive-blank-lines": false,
|
||||
"no-construct": false,
|
||||
"no-declare-current-package": false,
|
||||
"no-duplicate-imports": false,
|
||||
"no-duplicate-variable": false,
|
||||
"no-empty-interface": false,
|
||||
"no-for-in-array": false,
|
||||
"no-inferrable-types": false,
|
||||
"no-internal-module": false,
|
||||
"no-irregular-whitespace": false,
|
||||
"no-mergeable-namespace": false,
|
||||
"no-misused-new": false,
|
||||
"no-namespace": false,
|
||||
"no-object-literal-type-assertion": false,
|
||||
"no-padding": false,
|
||||
"no-redundant-jsdoc": false,
|
||||
"no-redundant-jsdoc-2": false,
|
||||
"no-redundant-undefined": false,
|
||||
"no-reference-import": false,
|
||||
"no-relative-import-in-test": false,
|
||||
"no-self-import": false,
|
||||
"no-single-declare-module": false,
|
||||
"no-string-throw": false,
|
||||
"no-unnecessary-callback-wrapper": false,
|
||||
"no-unnecessary-class": false,
|
||||
"no-unnecessary-generics": false,
|
||||
"no-unnecessary-qualifier": false,
|
||||
"no-unnecessary-type-assertion": false,
|
||||
"no-useless-files": false,
|
||||
"no-var-keyword": false,
|
||||
"no-var-requires": false,
|
||||
"no-void-expression": false,
|
||||
"no-trailing-whitespace": false,
|
||||
"object-literal-key-quotes": false,
|
||||
"object-literal-shorthand": false,
|
||||
"one-line": false,
|
||||
"one-variable-per-declaration": false,
|
||||
"only-arrow-functions": false,
|
||||
"prefer-conditional-expression": false,
|
||||
"prefer-const": false,
|
||||
"prefer-declare-function": false,
|
||||
"prefer-for-of": false,
|
||||
"prefer-method-signature": false,
|
||||
"prefer-template": false,
|
||||
"radix": false,
|
||||
"semicolon": false,
|
||||
"space-before-function-paren": false,
|
||||
"space-within-parens": false,
|
||||
"strict-export-declare-modifiers": false,
|
||||
"trim-file": false,
|
||||
"triple-equals": false,
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
}
|
||||
}
|
||||
188
types/should/index.d.ts
vendored
188
types/should/index.d.ts
vendored
@@ -1,188 +0,0 @@
|
||||
// Type definitions for should.js v11.2.0
|
||||
// Project: https://github.com/shouldjs/should.js
|
||||
// Definitions by: Alex Varju <https://github.com/varju>
|
||||
// Maxime LUCE <https://github.com/SomaticIT/>
|
||||
// Lukas Spieß <https://github.com/lumaxis/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
interface Object {
|
||||
should: ShouldAssertion;
|
||||
}
|
||||
|
||||
interface ShouldAssertion {
|
||||
// basic grammar
|
||||
a: ShouldAssertion;
|
||||
an: ShouldAssertion;
|
||||
and: ShouldAssertion;
|
||||
be: ShouldAssertion;
|
||||
has: ShouldAssertion;
|
||||
have: ShouldAssertion;
|
||||
is: ShouldAssertion;
|
||||
it: ShouldAssertion;
|
||||
with: ShouldAssertion;
|
||||
which: ShouldAssertion;
|
||||
the: ShouldAssertion;
|
||||
of: ShouldAssertion;
|
||||
not: ShouldAssertion;
|
||||
|
||||
// validators
|
||||
arguments(): ShouldAssertion;
|
||||
empty(): ShouldAssertion;
|
||||
ok(): ShouldAssertion;
|
||||
true(): ShouldAssertion;
|
||||
false(): ShouldAssertion;
|
||||
NaN(): ShouldAssertion;
|
||||
Infinity(): ShouldAssertion;
|
||||
Array(): ShouldAssertion;
|
||||
Object(): ShouldAssertion;
|
||||
String(): ShouldAssertion;
|
||||
Boolean(): ShouldAssertion;
|
||||
Number(): ShouldAssertion;
|
||||
Error(): ShouldAssertion;
|
||||
Function(): ShouldAssertion;
|
||||
Date(): ShouldAssertion;
|
||||
Class(): ShouldAssertion;
|
||||
Undefined(): ShouldAssertion;
|
||||
Null(): ShouldAssertion;
|
||||
Promise(): ShouldAssertion;
|
||||
generator(): ShouldAssertion;
|
||||
iterable(): ShouldAssertion;
|
||||
iterator(): ShouldAssertion;
|
||||
eql(expected: any, description?: string): ShouldAssertion;
|
||||
equal(expected: any, description?: string): ShouldAssertion;
|
||||
equalOneOf(...values: any[]): ShouldAssertion;
|
||||
within(start: number, finish: number, description?: string): ShouldAssertion;
|
||||
approximately(value: number, delta: number, description?: string): ShouldAssertion;
|
||||
type(expected: any, description?: string): ShouldAssertion;
|
||||
instanceof(constructor: Function, description?: string): ShouldAssertion;
|
||||
above(n: number, description?: string): ShouldAssertion;
|
||||
below(n: number, description?: string): ShouldAssertion;
|
||||
aboveOrEqual(n: number, description?: string): ShouldAssertion;
|
||||
greaterThanOrEqual(n: number, description?: string): ShouldAssertion;
|
||||
belowOrEqual(n: number, description?: string): ShouldAssertion;
|
||||
lessThanOrEqual(n: number, description?: string): ShouldAssertion;
|
||||
match(other: {}, description?: string): ShouldAssertion;
|
||||
match(other: (val: any) => any, description?: string): ShouldAssertion;
|
||||
match(regexp: RegExp, description?: string): ShouldAssertion;
|
||||
match(other: any, description?: string): ShouldAssertion;
|
||||
matchEach(other: {}, description?: string): ShouldAssertion;
|
||||
matchEach(other: (val: any) => any, description?: string): ShouldAssertion;
|
||||
matchEach(regexp: RegExp, description?: string): ShouldAssertion;
|
||||
matchEach(other: any, description?: string): ShouldAssertion;
|
||||
matchAny(other: {}, description?: string): ShouldAssertion;
|
||||
matchAny(other: (val: any) => any, description?: string): ShouldAssertion;
|
||||
matchAny(regexp: RegExp, description?: string): ShouldAssertion;
|
||||
matchAny(other: any, description?: string): ShouldAssertion;
|
||||
length(n: number, description?: string): ShouldAssertion;
|
||||
property(name: string, description?: string): ShouldAssertion;
|
||||
property(name: string, val: any, description?: string): ShouldAssertion;
|
||||
properties(names: string[]): ShouldAssertion;
|
||||
properties(name: string): ShouldAssertion;
|
||||
properties(descriptor: any): ShouldAssertion;
|
||||
properties(...properties: string[]): ShouldAssertion;
|
||||
propertyByPath(...properties: string[]): ShouldAssertion;
|
||||
propertyWithDescriptor(name: string, descriptor: PropertyDescriptor): ShouldAssertion;
|
||||
oneOf(...values: any[]): ShouldAssertion;
|
||||
ownProperty(name: string, description?: string): ShouldAssertion;
|
||||
containEql(obj: any): ShouldAssertion;
|
||||
containDeep(obj: any): ShouldAssertion;
|
||||
containDeepOrdered(obj: any): ShouldAssertion;
|
||||
keys(...allKeys: string[]): ShouldAssertion;
|
||||
keys(allKeys: string[]): ShouldAssertion;
|
||||
enumerable(property: string, value?: any): ShouldAssertion;
|
||||
size(size: number): ShouldAssertion;
|
||||
value(key: string | number, value: any): ShouldAssertion;
|
||||
enumerables(...properties: string[]): ShouldAssertion;
|
||||
startWith(expected: string, message?: any): ShouldAssertion;
|
||||
endWith(expected: string, message?: any): ShouldAssertion;
|
||||
throw(message?: any, properties?: {}): ShouldAssertion;
|
||||
|
||||
//promises
|
||||
eventually: ShouldAssertion;
|
||||
finally: ShouldAssertion;
|
||||
fulfilled(): Promise<any>;
|
||||
fulfilledWith(value: any): Promise<any>
|
||||
rejected(): Promise<any>;
|
||||
rejectedWith(message: (string | Function | RegExp), properties?: {}): Promise<any>;
|
||||
rejectedWith(errType: Object): Promise<any>;
|
||||
|
||||
//http
|
||||
header(field: string, val?: string): ShouldAssertion;
|
||||
status(code: number): ShouldAssertion;
|
||||
json(): ShouldAssertion;
|
||||
html(): ShouldAssertion;
|
||||
|
||||
//stubs
|
||||
alwaysCalledOn(thisTarget: any): ShouldAssertion;
|
||||
alwaysCalledWith(...arguments: any[]): ShouldAssertion;
|
||||
alwaysCalledWithExactly(...arguments: any[]): ShouldAssertion;
|
||||
alwaysCalledWithMatch(...arguments: any[]): ShouldAssertion;
|
||||
alwaysCalledWithNew(): ShouldAssertion;
|
||||
alwaysThrew(exception?: any): ShouldAssertion;
|
||||
callCount(count: number): ShouldAssertion;
|
||||
called(): ShouldAssertion;
|
||||
calledOn(thisTarget: any): ShouldAssertion;
|
||||
calledOnce(): ShouldAssertion;
|
||||
calledTwice(): ShouldAssertion;
|
||||
calledThrice(): ShouldAssertion;
|
||||
calledWith(...arguments: any[]): ShouldAssertion;
|
||||
calledWithExactly(...arguments: any[]): ShouldAssertion;
|
||||
calledWithMatch(...arguments: any[]): ShouldAssertion;
|
||||
calledWithNew(): ShouldAssertion;
|
||||
neverCalledWith(...arguments: any[]): ShouldAssertion;
|
||||
neverCalledWithMatch(...arguments: any[]): ShouldAssertion;
|
||||
threw(exception?: any): ShouldAssertion;
|
||||
|
||||
// aliases
|
||||
True(): ShouldAssertion;
|
||||
False(): ShouldAssertion;
|
||||
Arguments(): ShouldAssertion;
|
||||
class(): ShouldAssertion;
|
||||
deepEqual(expected: any, description?: string): ShouldAssertion;
|
||||
exactly(expected: any, description?: string): ShouldAssertion;
|
||||
instanceOf(constructor: Function, description?: string): ShouldAssertion;
|
||||
throwError(message?: any, properties?: {}): ShouldAssertion;
|
||||
lengthOf(n: number, description?: string): ShouldAssertion;
|
||||
key(key: string): ShouldAssertion;
|
||||
hasOwnProperty(name: string, description?: string): ShouldAssertion;
|
||||
greaterThan(n: number, description?: string): ShouldAssertion;
|
||||
lessThan(n: number, description?: string): ShouldAssertion;
|
||||
null(): ShouldAssertion;
|
||||
undefined(): ShouldAssertion;
|
||||
}
|
||||
|
||||
interface ShouldInternal {
|
||||
// should.js's extras
|
||||
exist(actual: any, msg?: string): void;
|
||||
exists(actual: any, msg?: string): void;
|
||||
not: ShouldInternal;
|
||||
}
|
||||
|
||||
interface Internal extends ShouldInternal {
|
||||
(obj: any): ShouldAssertion;
|
||||
|
||||
// node.js's assert functions
|
||||
fail(actual: any, expected: any, message: string, operator: string): void;
|
||||
assert(value: any, message: string): void;
|
||||
ok(value: any, message?: string): void;
|
||||
equal(actual: any, expected: any, message?: string): void;
|
||||
notEqual(actual: any, expected: any, message?: string): void;
|
||||
deepEqual(actual: any, expected: any, message?: string): void;
|
||||
notDeepEqual(actual: any, expected: any, message?: string): void;
|
||||
strictEqual(actual: any, expected: any, message?: string): void;
|
||||
notStrictEqual(actual: any, expected: any, message?: string): void;
|
||||
throws(block: any, error?: any, message?: string): void;
|
||||
doesNotThrow(block: any, message?: string): void;
|
||||
ifError(value: any): void;
|
||||
inspect(value: any, obj: any): any;
|
||||
}
|
||||
|
||||
declare var should: Internal;
|
||||
declare var Should: Internal;
|
||||
interface Window {
|
||||
Should: Internal;
|
||||
}
|
||||
|
||||
declare module "should" {
|
||||
export = should;
|
||||
}
|
||||
@@ -1,286 +0,0 @@
|
||||
|
||||
|
||||
import should = require('should');
|
||||
|
||||
should.fail('actual', 'expected', 'msg', 'operator');
|
||||
should.assert('value', 'msg');
|
||||
should.ok('value');
|
||||
should.equal('actual', 'expected');
|
||||
should.notEqual('actual', 'expected');
|
||||
should.deepEqual('actual', 'expected');
|
||||
should.notDeepEqual('actual', 'expected');
|
||||
should.strictEqual('actual', 'expected');
|
||||
should.notStrictEqual('actual', 'expected');
|
||||
should.throws(() => {});
|
||||
should.doesNotThrow(() => {});
|
||||
should.ifError('value');
|
||||
|
||||
(0).should
|
||||
.a
|
||||
.an
|
||||
.and
|
||||
.be
|
||||
.has
|
||||
.have
|
||||
.is
|
||||
.it
|
||||
.of
|
||||
.the
|
||||
.which
|
||||
.with
|
||||
.equal(0)
|
||||
|
||||
class User {
|
||||
name: string;
|
||||
pets: string[];
|
||||
age: number;
|
||||
}
|
||||
|
||||
var user = {
|
||||
name: 'tj',
|
||||
pets: ['tobi', 'loki', 'jane', 'bandit'],
|
||||
age: 17
|
||||
};
|
||||
|
||||
user.should.have.property('name', 'tj');
|
||||
user.should.have.property('pets').with.lengthOf(4);
|
||||
|
||||
should.exist('hello');
|
||||
should.exist([]);
|
||||
should.exist(null);
|
||||
|
||||
should.not.exist(false);
|
||||
should.not.exist('');
|
||||
should.not.exist({});
|
||||
|
||||
Should.exist(null);
|
||||
window.Should.exist(null);
|
||||
|
||||
user.should.have.property('pets').with.lengthOf(4);
|
||||
user.pets.should.have.lengthOf(4);
|
||||
user.should.be.of.type('object').and.have.property('name', 'tj');
|
||||
|
||||
'foo'.should.equal('bar');
|
||||
|
||||
should.exist({});
|
||||
should.exist([]);
|
||||
should.exist('');
|
||||
should.exist(0);
|
||||
should.exist(null);
|
||||
should.exist(undefined);
|
||||
|
||||
should.not.exist(undefined);
|
||||
should.not.exist(null);
|
||||
should.not.exist('');
|
||||
should.not.exist({});
|
||||
|
||||
true.should.be.ok();
|
||||
'yay'.should.be.ok();
|
||||
(1).should.be.ok();
|
||||
|
||||
false.should.not.be.ok();
|
||||
''.should.not.be.ok();
|
||||
(0).should.not.be.ok();
|
||||
|
||||
true.should.be.true();
|
||||
true.should.be.True();
|
||||
'1'.should.not.be.true();
|
||||
|
||||
false.should.be.false();
|
||||
false.should.be.False();
|
||||
(0).should.not.be.false();
|
||||
|
||||
var args = function (a: string, b: string, c: string) { return arguments; };
|
||||
args.should.be.arguments();
|
||||
args.should.be.Arguments();
|
||||
['a'].should.not.be.arguments();
|
||||
|
||||
['a'].should.be.empty();
|
||||
''.should.be.empty();
|
||||
({ length: 0 }).should.be.empty();
|
||||
|
||||
({ foo: 'bar' }).should.eql({ foo: 'bar' });
|
||||
[1, 2, 3].should.eql([1, 2, 3]);
|
||||
[1, 2, 3].should.deepEqual([1, 2, 3]);
|
||||
|
||||
(4).should.equal(4);
|
||||
'test'.should.equal('test');
|
||||
[1, 2, 3].should.not.equal([1, 2, 3]);
|
||||
|
||||
'ab'.should.equalOneOf('a', 10, 'ab');
|
||||
'ab'.should.equalOneOf(['a', 10, 'ab']);
|
||||
|
||||
({a: 10}).should.be.oneOf('a', 10, 'ab', {a: 10});
|
||||
({a: 10}).should.be.oneOf(['a', 10, 'ab', {a: 10}]);
|
||||
|
||||
'1'.should.be.exactly('1');
|
||||
'1'.should.not.be.exactly(1);
|
||||
|
||||
user.age.should.be.within(5, 50);
|
||||
|
||||
user.should.be.of.type('object');
|
||||
'test'.should.be.of.type('string');
|
||||
|
||||
user.should.be.an.instanceof(User);
|
||||
['a'].should.be.an.instanceOf(Array);
|
||||
|
||||
user.age.should.be.above(5);
|
||||
user.age.should.not.be.above(100);
|
||||
|
||||
user.age.should.be.below(100);
|
||||
user.age.should.not.be.below(5);
|
||||
|
||||
'username'.should.match(/^\w+$/);
|
||||
|
||||
user.pets.should.have.length(5);
|
||||
user.pets.should.have.lengthOf(5);
|
||||
|
||||
user.should.have.property('name');
|
||||
user.should.have.property('age', 15);
|
||||
user.should.not.have.property('rawr');
|
||||
user.should.not.have.property('age', 0);
|
||||
|
||||
({ a: 10 }).should.have.properties('a');
|
||||
({ a: 10, b: 20 }).should.have.properties([ 'a' ]);
|
||||
({ a: 10, b: 20 }).should.have.properties({ b: 20 });
|
||||
({ foo: 'bar' }).should.have.ownProperty('foo');
|
||||
({ foo: 'bar' }).should.hasOwnProperty('foo');
|
||||
({ a: {b: 10}}).should.have.propertyByPath('a', 'b').eql(10);
|
||||
({ a: 10 }).should.have.propertyWithDescriptor('a', { enumerable: true });
|
||||
|
||||
NaN.should.be.NaN();
|
||||
Infinity.should.be.Infinity();
|
||||
new Date().should.be.a.Date();
|
||||
({}).should.be.an.Object();
|
||||
"".should.be.a.String();
|
||||
true.should.be.a.Boolean();
|
||||
(4).should.be.a.Number();
|
||||
new ReferenceError("error").should.be.an.Error();
|
||||
(function() {}).should.be.a.Function();
|
||||
User.should.be.a.class();
|
||||
User.should.be.a.Class();
|
||||
'a'.should.not.be.a.generator();
|
||||
[].should.be.iterable();
|
||||
[].should.be.an.iterator();
|
||||
[].should.be.an.Array();
|
||||
should(undefined).be.undefined();
|
||||
should(null).be.null();
|
||||
|
||||
var res = {};
|
||||
res.should.have.status(200);
|
||||
|
||||
res.should.have.header('content-length');
|
||||
res.should.have.header('Content-Length', '123');
|
||||
res.should.have.header('content-length', '123');
|
||||
|
||||
res.should.be.json();
|
||||
|
||||
res.should.be.html();
|
||||
|
||||
[1, 2, 3].should.containEql(3);
|
||||
[1, 2, 3].should.containEql(2);
|
||||
[1, 2, 3].should.not.containEql(4);
|
||||
|
||||
'foo bar baz'.should.containEql('foo');
|
||||
'foo bar baz'.should.containEql('bar');
|
||||
'foo bar baz'.should.containEql('baz');
|
||||
'foo bar baz'.should.not.containEql('FOO')
|
||||
|
||||
var tobi = { name: 'Tobi', age: 1 };
|
||||
var jane = { name: 'Jane', age: 5 };
|
||||
var tj = { name: 'TJ', pet: tobi };
|
||||
tj.should.containEql({ pet: tobi });
|
||||
tj.should.containEql({ pet: tobi, name: 'TJ' });
|
||||
tj.should.not.containEql({ pet: jane });
|
||||
tj.should.not.containEql({ name: 'Someone' });
|
||||
|
||||
[[1], [2], [3]].should.containEql([3]);
|
||||
[[1], [2], [3]].should.containEql([2]);
|
||||
[[1], [2], [3]].should.not.containEql([4]);
|
||||
|
||||
var spy = function() { };
|
||||
spy.should.be.alwaysCalledOn({});
|
||||
spy.should.be.alwaysCalledWith(1, 2);
|
||||
spy.should.be.alwaysCalledWithExactly(1, 2);
|
||||
spy.should.be.alwaysCalledWithMatch(1, 2);
|
||||
spy.should.have.alwaysThrew("ReferenceError");
|
||||
spy.should.have.callCount(1);
|
||||
spy.should.be.called();
|
||||
spy.should.be.calledOn({});
|
||||
spy.should.be.calledOnce();
|
||||
spy.should.be.calledTwice();
|
||||
spy.should.be.calledThrice();
|
||||
spy.should.be.calledWith(1, 2);
|
||||
spy.should.be.calledWithExactly(1, 2);
|
||||
spy.should.be.calledWithMatch(1, 2);
|
||||
spy.should.be.calledWithNew();
|
||||
spy.should.be.neverCalledWith(1, 2);
|
||||
spy.should.be.neverCalledWithMatch(1, 2);
|
||||
spy.should.have.threw("ReferenceError");
|
||||
|
||||
(10).should.be.aboveOrEqual(0);
|
||||
(10).should.be.aboveOrEqual(10);
|
||||
(10).should.be.greaterThanOrEqual(0);
|
||||
(10).should.be.greaterThanOrEqual(10);
|
||||
|
||||
(0).should.be.belowOrEqual(10);
|
||||
(0).should.be.belowOrEqual(0);
|
||||
(0).should.be.lessThanOrEqual(10);
|
||||
(0).should.be.lessThanOrEqual(0);
|
||||
|
||||
(function () {
|
||||
throw new Error('fail');
|
||||
}).should.throw();
|
||||
|
||||
(function () {
|
||||
}).should.not.throw();
|
||||
|
||||
(function () {
|
||||
throw new Error('fail');
|
||||
}).should.throw('fail');
|
||||
|
||||
(function () {
|
||||
throw new Error('failed to foo');
|
||||
}).should.throw(/^fail/);
|
||||
|
||||
(function () {
|
||||
throw new Error('failed to foo');
|
||||
}).should.throw(Error);
|
||||
|
||||
(function () {
|
||||
throw new Error('failed to foo');
|
||||
}).should.throw(Error, { message: 'failed to baz' });
|
||||
|
||||
(function () {
|
||||
throw new Error('failed to foo');
|
||||
}).should.throwError(Error, { message: 'failed to baz' });
|
||||
|
||||
(function () {
|
||||
throw new Error('failed to baz');
|
||||
}).should.throwError(/^fail.*/);
|
||||
|
||||
var obj = { foo: 'bar', baz: 'raz' };
|
||||
obj.should.have.keys('foo', 'bar');
|
||||
obj.should.have.keys(['foo', 'bar']);
|
||||
obj.should.have.key('foo');
|
||||
|
||||
({ a: 10 }).should.have.size(1);
|
||||
|
||||
({ a: 10 }).should.have.value('a', 10);
|
||||
({ a: 10 }).should.have.value(1, 2);
|
||||
|
||||
({ a: 10 }).should.have.enumerable('a');
|
||||
({ a: 10 }).should.have.enumerable('a', 10);
|
||||
({ a: 10, b: 10 }).should.have.enumerables('a', 'b');
|
||||
|
||||
(1).should.eql(0, 'some useful description');
|
||||
|
||||
[ 1, 2, 3].should.containDeep([2, 1]);
|
||||
[ 1, 2, [ 1, 2, 3 ]].should.containDeep([ 1, [ 3, 1 ]]);
|
||||
|
||||
[ 1, 2, 3].should.containDeepOrdered([1, 2]);
|
||||
[ 1, 2, [ 1, 2, 3 ]].should.containDeepOrdered([ 1, [ 2, 3 ]]);
|
||||
|
||||
({ a: 10, b: { c: 10, d: [1, 2, 3] }}).should.containDeepOrdered({a: 10});
|
||||
({ a: 10, b: { c: 10, d: [1, 2, 3] }}).should.containDeepOrdered({b: {c: 10}});
|
||||
({ a: 10, b: { c: 10, d: [1, 2, 3] }}).should.containDeepOrdered({b: {d: [1, 3]}});
|
||||
@@ -1,24 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"should-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"adjacent-overload-signatures": false,
|
||||
"array-type": false,
|
||||
"arrow-return-shorthand": false,
|
||||
"ban-types": false,
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"eofline": false,
|
||||
"export-just-namespace": false,
|
||||
"import-spacing": false,
|
||||
"interface-name": false,
|
||||
"interface-over-type-literal": false,
|
||||
"jsdoc-format": false,
|
||||
"max-line-length": false,
|
||||
"member-access": false,
|
||||
"new-parens": false,
|
||||
"no-any-union": false,
|
||||
"no-boolean-literal-compare": false,
|
||||
"no-conditional-assignment": false,
|
||||
"no-consecutive-blank-lines": false,
|
||||
"no-construct": false,
|
||||
"no-declare-current-package": false,
|
||||
"no-duplicate-imports": false,
|
||||
"no-duplicate-variable": false,
|
||||
"no-empty-interface": false,
|
||||
"no-for-in-array": false,
|
||||
"no-inferrable-types": false,
|
||||
"no-internal-module": false,
|
||||
"no-irregular-whitespace": false,
|
||||
"no-mergeable-namespace": false,
|
||||
"no-misused-new": false,
|
||||
"no-namespace": false,
|
||||
"no-object-literal-type-assertion": false,
|
||||
"no-padding": false,
|
||||
"no-redundant-jsdoc": false,
|
||||
"no-redundant-jsdoc-2": false,
|
||||
"no-redundant-undefined": false,
|
||||
"no-reference-import": false,
|
||||
"no-relative-import-in-test": false,
|
||||
"no-self-import": false,
|
||||
"no-single-declare-module": false,
|
||||
"no-string-throw": false,
|
||||
"no-unnecessary-callback-wrapper": false,
|
||||
"no-unnecessary-class": false,
|
||||
"no-unnecessary-generics": false,
|
||||
"no-unnecessary-qualifier": false,
|
||||
"no-unnecessary-type-assertion": false,
|
||||
"no-useless-files": false,
|
||||
"no-var-keyword": false,
|
||||
"no-var-requires": false,
|
||||
"no-void-expression": false,
|
||||
"no-trailing-whitespace": false,
|
||||
"object-literal-key-quotes": false,
|
||||
"object-literal-shorthand": false,
|
||||
"one-line": false,
|
||||
"one-variable-per-declaration": false,
|
||||
"only-arrow-functions": false,
|
||||
"prefer-conditional-expression": false,
|
||||
"prefer-const": false,
|
||||
"prefer-declare-function": false,
|
||||
"prefer-for-of": false,
|
||||
"prefer-method-signature": false,
|
||||
"prefer-template": false,
|
||||
"radix": false,
|
||||
"semicolon": false,
|
||||
"space-before-function-paren": false,
|
||||
"space-within-parens": false,
|
||||
"strict-export-declare-modifiers": false,
|
||||
"trim-file": false,
|
||||
"triple-equals": false,
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
}
|
||||
}
|
||||
@@ -13,9 +13,20 @@ import File = require('vinyl');
|
||||
// const spies = require('./spy');
|
||||
declare const spies: any;
|
||||
|
||||
import * as should from 'should';
|
||||
import 'mocha';
|
||||
|
||||
// TODO: These aren't useful as types tests since they take `any`.
|
||||
declare const should: ShouldStatic;
|
||||
interface ShouldStatic {
|
||||
exist(obj: any, desc?: string): void;
|
||||
not: this;
|
||||
}
|
||||
declare global {
|
||||
interface Object {
|
||||
should: { equal(obj: any): void; };
|
||||
}
|
||||
}
|
||||
|
||||
declare const gulp: any;
|
||||
let bufferStream: any;
|
||||
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
/// <reference types="mocha" />
|
||||
/// <reference types="should" />
|
||||
|
||||
|
||||
|
||||
import File = require('vinyl');
|
||||
import Stream = require('stream');
|
||||
@@ -9,6 +6,23 @@ import fs = require('fs');
|
||||
|
||||
declare var fakeStream: NodeJS.ReadWriteStream;
|
||||
|
||||
// TODO: These aren't useful as types tests since they take `any`.
|
||||
declare const should: ShouldStatic;
|
||||
interface ShouldStatic {
|
||||
exist(obj: any, desc?: string): void;
|
||||
not: this;
|
||||
};
|
||||
interface Should {
|
||||
be: { true: undefined; false: undefined; };
|
||||
equal(obj: any, desc?: string): void;
|
||||
not: this;
|
||||
}
|
||||
declare global {
|
||||
interface Object {
|
||||
should: Should;
|
||||
}
|
||||
}
|
||||
|
||||
describe('File', () => {
|
||||
|
||||
describe('constructor()', () => {
|
||||
|
||||
Reference in New Issue
Block a user