Skip to content

Commit

Permalink
fix typo in overridden name
Browse files Browse the repository at this point in the history
  • Loading branch information
vladbasin committed Jan 10, 2024
1 parent c12eb06 commit 9fc9d03
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions src/Result.ts
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ export class Result<T> {
* @param value New value
* @returns New Result which stores new value
*/
public withOverridenValue<V>(value: V): Result<V> {
public withOverriddenValue<V>(value: V): Result<V> {
return this.onSuccess(_ => Result.Ok(value));
}

Expand All @@ -327,16 +327,16 @@ export class Result<T> {
* @param value New error
* @returns New Result which stores new error
*/
public withOverridenFail(newError: string): Result<T> {
return this.withOverridenFailError(new Error(newError));
public withOverriddenFail(newError: string): Result<T> {
return this.withOverriddenFailError(new Error(newError));
}

/**
* Overrides current error
* @param value New error
* @returns New Result which stores new error
*/
public withOverridenFailError(newError: Error): Result<T> {
public withOverriddenFailError(newError: Error): Result<T> {
return this.onFailureCompensate(_ => Result.FailWithError(newError, this._context));
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { Result } from '../src/Result';
import { executeResult } from './executeResult';

describe('.withOverridenFail()', () => {
describe('.withOverriddenFail()', () => {
test('overrides value', done => {
const record = jest.fn();

executeResult(
done,
Result.Fail('error')
.withOverridenFail('newError')
.withOverriddenFail('newError')
.onFailure(error => {
expect(error).toBe('newError');
record();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { Result } from '../src/Result';
import { executeResult } from './executeResult';

describe('.withOverridenFailError()', () => {
describe('.withOverriddenFailError()', () => {
test('overrides value', done => {
const record = jest.fn();

executeResult(
done,
Result.Fail('error')
.withOverridenFailError(new Error('newError'))
.withOverriddenFailError(new Error('newError'))
.onFailure(error => {
expect(error).toBe('newError');
record();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { Result } from '../src/Result';
import { executeResult } from './executeResult';

describe('.withOverridenValue()', () => {
describe('.withOverriddenValue()', () => {
test('overrides value', done => {
const record = jest.fn();

executeResult(
done,
Result.Ok(1)
.withOverridenValue(2)
.withOverriddenValue(2)
.onSuccess(payload => {
expect(payload).toBe(2);
record();
Expand Down

0 comments on commit 9fc9d03

Please sign in to comment.