Skip to content

Commit

Permalink
chore: run prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
acd02 committed Feb 22, 2020
1 parent 5d4add0 commit ef0db92
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 9 deletions.
14 changes: 12 additions & 2 deletions test/result.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,21 @@ describe('result', () => {
const successData: Data = makeData(10)

it('should execute the first function if value is an Err', () => {
expect(result(errData).fold(e => e.code, s => s.label.length)).toEqual(500)
expect(
result(errData).fold(
e => e.code,
s => s.label.length,
),
).toEqual(500)
})

it('should execute the second function if value is an Ok', () => {
expect(result(successData).fold(e => e.code, s => s.label.length)).toEqual(5)
expect(
result(successData).fold(
e => e.code,
s => s.label.length,
),
).toEqual(5)
})
})
})
35 changes: 28 additions & 7 deletions test/when.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ describe('when', () => {
when(item)
.map(i => i.label.toUpperCase())
.filter(w => w.length > 10)
.fold(() => 'none', w => w),
.fold(
() => 'none',
w => w,
),
).toEqual('none')
})

Expand All @@ -79,7 +82,10 @@ describe('when', () => {
when(item)
.map(i => i.label.toUpperCase())
.filter(w => w.length > 1)
.fold(() => 'none', w => w),
.fold(
() => 'none',
w => w,
),
).toEqual('OK')
})
})
Expand Down Expand Up @@ -168,14 +174,20 @@ describe('when', () => {
when((undefined as unknown) as Item)
.map(i => i.label.toUpperCase())
.filter(w => w.length > 10)
.fold(() => 'none', w => w),
.fold(
() => 'none',
w => w,
),
).toEqual('none')

expect(
when(item)
.map(i => i.label.toUpperCase())
.filter(w => w.length > 10)
.fold(() => 'none', w => w),
.fold(
() => 'none',
w => w,
),
).toEqual('none')
})

Expand All @@ -189,7 +201,10 @@ describe('when', () => {
when(item)
.map(i => i.label.toUpperCase())
.filter(w => w.length > 1)
.fold(() => 'none', w => w),
.fold(
() => 'none',
w => w,
),
).toEqual('OK')
})
})
Expand All @@ -212,13 +227,19 @@ describe('whenAll', () => {
expect(
whenAll(['one', 2, undefined, 'bar'])
.map(([word]) => word.toUpperCase())
.fold(() => 'none', w => w),
.fold(
() => 'none',
w => w,
),
).toEqual('none')

expect(
whenAll(['one', 2, 3, 'bar'])
.map(([word]) => word.toUpperCase())
.fold(() => 'none', w => w),
.fold(
() => 'none',
w => w,
),
).toEqual('ONE')
})
})

0 comments on commit ef0db92

Please sign in to comment.