diff --git a/tests/FixTest.elm b/tests/FixTest.elm index 65f52750..3a92233a 100644 --- a/tests/FixTest.elm +++ b/tests/FixTest.elm @@ -173,4 +173,37 @@ a = 1 |> Expect.equal """module A exposing (a) a = Debug.log "foo" 1 """ + , test "should apply multiple fixes regardless of the order" <| + \() -> + let + source : String + source = + """module A exposing (a) +a = 1 +""" + + fixes = + [ Fix.replaceRangeBy + { start = { row = 2, column = 1 } + , end = { row = 2, column = 2 } + } + "someVar" + , Fix.insertAt + { row = 2, column = 5 } + """Debug.log "foo" """ + ] + in + Expect.all + [ \() -> + Fix.fix fixes source + |> Expect.equal """module A exposing (a) +someVar = Debug.log "foo" 1 +""" + , \() -> + Fix.fix (List.reverse fixes) source + |> Expect.equal """module A exposing (a) +someVar = Debug.log "foo" 1 +""" + ] + () ]