codecombat/test/app/lib/deltas.spec.coffee
Scott Erickson 2855d2a402 Made the deltas lib conflict identifying library able to handle many-to-many conflicts.
Made conflict finding a bit more liberal, in that any messing with arrays (adding, removing or moving things inside) will conflict with any other such change.
2014-07-03 17:41:58 -07:00

18 lines
No EOL
612 B
CoffeeScript

deltas = require 'lib/deltas'
describe 'deltas lib', ->
describe 'getConflicts', ->
it 'handles conflicts where one change conflicts with several changes', ->
originalData = {list:[1,2,3]}
forkA = {list:['1', 2, '3']}
forkB = {noList: '...'}
differ = deltas.makeJSONDiffer()
expandedDeltaA = deltas.expandDelta(differ.diff originalData, forkA)
expandedDeltaB = deltas.expandDelta(differ.diff originalData, forkB)
deltas.getConflicts(expandedDeltaA, expandedDeltaB)
for delta in expandedDeltaA
expect(delta.conflict).toBeDefined()