Skip to content

Instantly share code, notes, and snippets.

@onespaceman
Last active May 10, 2024 00:43
Show Gist options
  • Save onespaceman/da4eaed2e6808e7342840c9f680ce84d to your computer and use it in GitHub Desktop.
Save onespaceman/da4eaed2e6808e7342840c9f680ce84d to your computer and use it in GitHub Desktop.
refactor tests

Setup: Space should have page.md, other.md, image.png and imageToMove.png

Tests

  1. Simple rename - page to newpage
  2. Rename with spaces - newpage to page with spaces
  3. To deeper folder - page with spaces to folder/page
  4. To shallower folder - folder/page to page
    1. Batch rename - page to folder/page and other to folder/other then prefix rename folder/ to very/deep/folder/

Wikilinks

  1. Should link to newpage
  2. Should link to page with spaces
  3. Should link to folder/page
  4. Should link to page
  5. Should link to very/deep/folder/page [[page]] Wikilink to page [[page|Alias]] [[page@10]] Wikilink with position [[page@10|Alias]] [[page#MDLinks]] Wikilink with header [[page#MDLinks|Alias]] [[page$anchor]] Wikilink with anchor [[page$anchor|Alias]]

MDLinks

  1. Should link to /newpage

  2. Should link to /page with spaces with <> brackets around the link

  3. Should link to /folder/page with no brackets

  4. Should link to /page

  5. Should link to /very/deep/folder/page Absolute to page Absolute with position Absolute with header Absolute with anchor

  6. Should link to newpage

  7. Should link to page with spaces with <> brackets around the link

  8. Should link to folder/page with no brackets

  9. Should link to page

  10. Should still link to page Relative to page Relative with position Relative with header Relative with anchor

Attachment

  • These links should never change [[image.png]] Wikilink to file [[image.png|Alias]] Absolute to file

1, 2, 3, 4. Should not change 5. Should change to ../../../image.png Relative to file

Tests

  1. Simple rename - page to newpage
  2. Rename with spaces - newpage to page with spaces
  3. To deeper folder - page with spaces to folder/page
  4. To shallower folder - folder/page to page
  5. Batch rename - page to folder/page and other to folder/other then prefix rename folder/ to very/deep/folder/

Wikilinks

1, 2, 3, 4. These links should not change 5. Should link to very/deep/folder/other [[other]] Wikilink to page [[other|Alias]] [[other@10]] Wikilink with position [[other@10|Alias]] [[other#MDLinks]] Wikilink with header [[other#MDLinks|Alias]] [[other$anchor]] Wikilink with anchor [[other$anchor|Alias]]

MDLinks

1, 2, 3, 4. These links should not change 5. Should link to /very/deep/folder/other Absolute to page Absolute with position Absolute with header Absolute with anchor

1, 2. Should not change 3. Should change to ../other 4. Should change back to other 5. Should still link to other Relative to page Relative with position Relative with header Relative with anchor

Attachment

  • These links should never change [[image.png]] Wikilink to file [[image.png|Alias]] Absolute to file

1, 2. Should not change 3. Should change to ../image.png 4. Should change back to image.png 5. Should change to ../../../image.png Relative to file

imageToMove.png is only linked to on this page. It should move along with this page 1, 2. Should not change 3. Should change to folder/imageToMove.png and /folder/imageToMove.png 4. Should change back to imageToMove.png and /imageToMove.png 5. Should change to very/deep/folder/imageToMove.png and /very/deep/folder/imageToMove.png [[imageToMove.png]] Absolute to file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment