diff --git a/src/ReactTestRenderer.re b/src/ReactTestRenderer.re index e5b4588bf..2c3494447 100644 --- a/src/ReactTestRenderer.re +++ b/src/ReactTestRenderer.re @@ -4,6 +4,7 @@ type t; external create: React.element => t = "create"; [@mel.send] external toJSON: t => Js.Json.t = "toJSON"; +[@mel.send] external toObject: t => Js.t({..}) = "%identity"; module Shallow = { type t; diff --git a/src/ReactTestRenderer.rei b/src/ReactTestRenderer.rei index ed7c0ebce..1e91c3160 100644 --- a/src/ReactTestRenderer.rei +++ b/src/ReactTestRenderer.rei @@ -4,6 +4,7 @@ type t; external create: React.element => t = "create"; [@mel.send] external toJSON: t => Js.Json.t = "toJSON"; +[@mel.send] external toObject: t => Js.t({.}) = "%identity"; module Shallow: { type t; diff --git a/test/ReactTestRenderer__test.re b/test/ReactTestRenderer__test.re index 2324b1dd9..2db87305d 100644 --- a/test/ReactTestRenderer__test.re +++ b/test/ReactTestRenderer__test.re @@ -1,7 +1,5 @@ open Jest; -external toObject: ReactTestRenderer.t => Js.t({.}) = "%identity"; - module Tester = { [@react.component] let make = () =>
{React.string("Tester")}
; @@ -12,7 +10,7 @@ describe("ReactTestRenderer", () => { test("create returns ReactTestInstance", () => { let component = ReactTestRenderer.create(); - let keys = Js.Obj.keys(Obj.magic(component): Js.t({..})); + let keys = Js.Obj.keys(ReactTestRenderer.toObject(component)); expect(keys) ->toEqual(