Align Bool isEmpty, true when false is wrapped (#1967)
This commit is contained in:
@@ -42,11 +42,11 @@ describe('Bool', (): void => {
|
||||
});
|
||||
|
||||
describe('utils', (): void => {
|
||||
it('compares agains a boolean', (): void => {
|
||||
it('compares against a boolean', (): void => {
|
||||
expect(new Bool(registry, true).eq(true)).toBe(true);
|
||||
});
|
||||
|
||||
it('compares agains a Bool', (): void => {
|
||||
it('compares against a Bool', (): void => {
|
||||
expect(new Bool(registry, false).eq(new Bool(registry, false))).toBe(true);
|
||||
});
|
||||
|
||||
@@ -57,5 +57,11 @@ describe('Bool', (): void => {
|
||||
it('has isFalse', (): void => {
|
||||
expect(new Bool(registry, true).isFalse).toBe(false);
|
||||
});
|
||||
|
||||
it('has sane isEmpty aligning with the rest', (): void => {
|
||||
expect(new Bool(registry).isEmpty).toBe(true);
|
||||
expect(new Bool(registry, false).isEmpty).toBe(true);
|
||||
expect(new Bool(registry, true).isEmpty).toBe(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -50,10 +50,10 @@ export default class Bool extends Boolean implements Codec {
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Checks if the value is an empty value (always false)
|
||||
* @description Checks if the value is an empty value (true when it wraps false/default)
|
||||
*/
|
||||
public get isEmpty (): boolean {
|
||||
return false;
|
||||
return this.isFalse;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user