Skip to content

Commit

Permalink
feat(booleans): deprecate toBeTrue|toBeFalse|toHaveTrue|toHaveFalse
Browse files Browse the repository at this point in the history
BREAKING CHANGE:
toBeTrue and toBeFalse have been merged into Jasmine

Closes #124
  • Loading branch information
JamieMason committed Sep 19, 2020
1 parent 5682197 commit 8ad27d5
Show file tree
Hide file tree
Showing 12 changed files with 64 additions and 208 deletions.
52 changes: 32 additions & 20 deletions .github/README_CONTENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,24 +50,38 @@ The [Jasmine testing framework](http://jasmine.github.io/) from
[default set of matchers](http://jasmine.github.io/edge/introduction.html#section-Expectations):

```js
expect(instance).toBe(instance);
expect(number).toBeCloseTo(number, decimalPlaces);
expect(mixed).toBeDefined();
expect(mixed).toBeFalsy();
expect(number).toBeGreaterThan(number);
expect(number).toBeLessThan(number);
expect(number).toBeNaN();
expect(mixed).toBeNull();
expect(mixed).toBeTruthy();
expect(mixed).toBeUndefined();
expect(array).toContain(member);
expect(mixed).toEqual(mixed);
expect(spy).toHaveBeenCalled();
expect(spy).toHaveBeenCalledTimes(number);
expect(spy).toHaveBeenCalledWith(...arguments);
expect(mixed).toMatch(pattern);
expect(fn).toThrow(string);
expect(fn).toThrowError(string);
expect().nothing()
expect().toBe(expected)
expect().toBeCloseTo(expected, precisionopt)
expect().toBeDefined()
expect().toBeFalse()
expect().toBeFalsy()
expect().toBeGreaterThan(expected)
expect().toBeGreaterThanOrEqual(expected)
expect().toBeInstanceOf(expected)
expect().toBeLessThan(expected)
expect().toBeLessThanOrEqual(expected)
expect().toBeNaN()
expect().toBeNegativeInfinity()
expect().toBeNull()
expect().toBePositiveInfinity()
expect().toBeTrue()
expect().toBeTruthy()
expect().toBeUndefined()
expect().toContain(expected)
expect().toEqual(expected)
expect().toHaveBeenCalled()
expect().toHaveBeenCalledBefore(expected)
expect().toHaveBeenCalledOnceWith()
expect().toHaveBeenCalledTimes(expected)
expect().toHaveBeenCalledWith()
expect().toHaveClass(expected)
expect().toHaveSize(expected)
expect().toMatch(expected)
expect().toThrow(expectedopt)
expect().toThrowError(expectedopt, messageopt)
expect().toThrowMatching(predicate)
expect().withContext(message)
```

and this
Expand Down Expand Up @@ -96,8 +110,6 @@ expect(array).toBeArrayOfStrings();
expect(array).toBeEmptyArray();
expect(array).toBeNonEmptyArray();
expect(boolean).toBeBoolean();
expect(boolean).toBeFalse();
expect(boolean).toBeTrue();
expect(date).toBeAfter(otherDate);
expect(date).toBeBefore(otherDate);
expect(date).toBeDate();
Expand Down
52 changes: 32 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,24 +54,38 @@ Downloads are available on the [releases](https://github.com/JamieMason/Jasmine-
The [Jasmine testing framework](http://jasmine.github.io/) from [Pivotal Labs](http://pivotallabs.com/) comes with this [default set of matchers](http://jasmine.github.io/edge/introduction.html#section-Expectations):

```js
expect(instance).toBe(instance);
expect(number).toBeCloseTo(number, decimalPlaces);
expect(mixed).toBeDefined();
expect(mixed).toBeFalsy();
expect(number).toBeGreaterThan(number);
expect(number).toBeLessThan(number);
expect(number).toBeNaN();
expect(mixed).toBeNull();
expect(mixed).toBeTruthy();
expect(mixed).toBeUndefined();
expect(array).toContain(member);
expect(mixed).toEqual(mixed);
expect(spy).toHaveBeenCalled();
expect(spy).toHaveBeenCalledTimes(number);
expect(spy).toHaveBeenCalledWith(...arguments);
expect(mixed).toMatch(pattern);
expect(fn).toThrow(string);
expect(fn).toThrowError(string);
expect().nothing()
expect().toBe(expected)
expect().toBeCloseTo(expected, precisionopt)
expect().toBeDefined()
expect().toBeFalse()
expect().toBeFalsy()
expect().toBeGreaterThan(expected)
expect().toBeGreaterThanOrEqual(expected)
expect().toBeInstanceOf(expected)
expect().toBeLessThan(expected)
expect().toBeLessThanOrEqual(expected)
expect().toBeNaN()
expect().toBeNegativeInfinity()
expect().toBeNull()
expect().toBePositiveInfinity()
expect().toBeTrue()
expect().toBeTruthy()
expect().toBeUndefined()
expect().toContain(expected)
expect().toEqual(expected)
expect().toHaveBeenCalled()
expect().toHaveBeenCalledBefore(expected)
expect().toHaveBeenCalledOnceWith()
expect().toHaveBeenCalledTimes(expected)
expect().toHaveBeenCalledWith()
expect().toHaveClass(expected)
expect().toHaveSize(expected)
expect().toMatch(expected)
expect().toThrow(expectedopt)
expect().toThrowError(expectedopt, messageopt)
expect().toThrowMatching(predicate)
expect().withContext(message)
```

and this [default set of asymmetric matchers](http://jasmine.github.io/2.4/introduction.html#section-Matching_Anything_with_%3Ccode%3Ejasmine.any%3C/code%3E);
Expand All @@ -98,8 +112,6 @@ expect(array).toBeArrayOfStrings();
expect(array).toBeEmptyArray();
expect(array).toBeNonEmptyArray();
expect(boolean).toBeBoolean();
expect(boolean).toBeFalse();
expect(boolean).toBeTrue();
expect(date).toBeAfter(otherDate);
expect(date).toBeBefore(otherDate);
expect(date).toBeDate();
Expand Down
4 changes: 0 additions & 4 deletions src/matchersByName.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export { toBeEmptyArray } from './toBeEmptyArray';
export { toBeEmptyObject } from './toBeEmptyObject';
export { toBeEmptyString } from './toBeEmptyString';
export { toBeEvenNumber } from './toBeEvenNumber';
export { toBeFalse } from './toBeFalse';
export { toBeFunction } from './toBeFunction';
export { toBeGreaterThanOrEqualTo } from './toBeGreaterThanOrEqualTo';
export { toBeHtmlString } from './toBeHtmlString';
Expand All @@ -32,7 +31,6 @@ export { toBeRegExp } from './toBeRegExp';
export { toBeSameLengthAs } from './toBeSameLengthAs';
export { toBeShorterThan } from './toBeShorterThan';
export { toBeString } from './toBeString';
export { toBeTrue } from './toBeTrue';
export { toBeValidDate } from './toBeValidDate';
export { toBeWhitespace } from './toBeWhitespace';
export { toBeWholeNumber } from './toBeWholeNumber';
Expand All @@ -53,7 +51,6 @@ export { toHaveEmptyArray } from './toHaveEmptyArray';
export { toHaveEmptyObject } from './toHaveEmptyObject';
export { toHaveEmptyString } from './toHaveEmptyString';
export { toHaveEvenNumber } from './toHaveEvenNumber';
export { toHaveFalse } from './toHaveFalse';
export { toHaveHtmlString } from './toHaveHtmlString';
export { toHaveIso8601 } from './toHaveIso8601';
export { toHaveJsonString } from './toHaveJsonString';
Expand All @@ -70,7 +67,6 @@ export { toHaveString } from './toHaveString';
export { toHaveStringLongerThan } from './toHaveStringLongerThan';
export { toHaveStringSameLengthAs } from './toHaveStringSameLengthAs';
export { toHaveStringShorterThan } from './toHaveStringShorterThan';
export { toHaveTrue } from './toHaveTrue';
export { toHaveUndefined } from './toHaveUndefined';
export { toHaveWhitespaceString } from './toHaveWhitespaceString';
export { toHaveWholeNumber } from './toHaveWholeNumber';
Expand Down
14 changes: 0 additions & 14 deletions src/toBeFalse.ts

This file was deleted.

14 changes: 0 additions & 14 deletions src/toBeTrue.ts

This file was deleted.

14 changes: 0 additions & 14 deletions src/toHaveFalse.ts

This file was deleted.

14 changes: 0 additions & 14 deletions src/toHaveTrue.ts

This file was deleted.

2 changes: 0 additions & 2 deletions test/optionalMessages.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ it('should handle optional messages', () => {
expect({}).toBeEmptyObject(MSG);
expect('').toBeEmptyString(MSG);
expect(2).toBeEvenNumber(MSG);
expect(false).toBeFalse(MSG);
expect(() => {}).toBeFunction(MSG);
expect('<element>text</element>').toBeHtmlString(MSG);
expect('2013-07-08T07:29:15.863Z').toBeIso8601(MSG);
Expand All @@ -35,7 +34,6 @@ it('should handle optional messages', () => {
expect('ab').toBeSameLengthAs('ab', MSG);
expect('ab').toBeShorterThan('abc', MSG);
expect('').toBeString(MSG);
expect(true).toBeTrue(MSG);
expect(new Date()).toBeValidDate(MSG);
expect(' ').toBeWhitespace(MSG);
expect(1).toBeWholeNumber(MSG);
Expand Down
15 changes: 0 additions & 15 deletions test/toBeFalse.spec.js

This file was deleted.

15 changes: 0 additions & 15 deletions test/toBeTrue.spec.js

This file was deleted.

38 changes: 0 additions & 38 deletions test/toHaveFalse.spec.js

This file was deleted.

38 changes: 0 additions & 38 deletions test/toHaveTrue.spec.js

This file was deleted.

0 comments on commit 8ad27d5

Please sign in to comment.