Skip to content

Commit

Permalink
fix(fio): fix issue with return value after using provide with an asy…
Browse files Browse the repository at this point in the history
…nc function
  • Loading branch information
tusharmath committed Jul 18, 2019
1 parent e7d3859 commit 459a78a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/internals/Evaluate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ export const Evaluate = <E, A>(

case Tag.Provide:
stackA.push(
FIO.try(() => {
FIO.resume(i => {
stackEnv.pop()

return data
return i
}).asInstruction
)
stackA.push(j.i0)
Expand Down
11 changes: 11 additions & 0 deletions test/FIO.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -524,5 +524,16 @@ describe('FIO', () => {

assert.strictEqual(actual, expected)
})

it('should provide env to async functions', () => {
const actual = testRuntime().executeSync(
FIO.access((_: number) => _ + 1)
.delay(1000)
.provide(10)
)
const expected = 11

assert.strictEqual(actual, expected)
})
})
})

0 comments on commit 459a78a

Please sign in to comment.