fedwiki/wiki-client — pull request #52 by WardCunningham (2014-08-03 23:19:54+00:00)
Title: Ward/relative move

This pull request is motivated by the drag-and-drop merging of journals. This has turned out to be a lot more work than expected, mostly due to carelessly conceived unit tests that confused more than illuminated my work. I've chosen to use the node-server implementation as the definition of 'correct' where it and the unit tests disagreed.

I've replaced the unit tests with smaller and more comprehensive tests based on a situation modeling language which is itself tested as a prolog to the tests. For example, here we create a page with three items:

data = Fixture
story: [3, 1, 2]
journal: ['a1', 'a21', 'a3']

This says: the story is to be three paragraphs, t1, t2, and t3. These are created by adding t1, then t2 after t1, and then t3 at the beginning (after nothing). A reasonable test would be to retrieve the final version and verify that the paragraphs are indeed in the order t3, t1, t2.

With good tests the modifications to lib/revision.coffee were straightforward.