diff options
-rw-r--r-- | jt1.pdf | bin | 0 -> 156345 bytes | |||
-rw-r--r-- | jt1.yarn | 123 | ||||
-rw-r--r-- | muck1.pdf | bin | 0 -> 142176 bytes | |||
-rw-r--r-- | muck2.pdf | bin | 0 -> 135291 bytes | |||
-rw-r--r-- | muck3.pdf | bin | 0 -> 143364 bytes |
5 files changed, 123 insertions, 0 deletions
Binary files differ diff --git a/jt1.yarn b/jt1.yarn new file mode 100644 index 0000000..e55a01b --- /dev/null +++ b/jt1.yarn @@ -0,0 +1,123 @@ +--- +title: JT acceptance tests v1 +author: Lars Wirzenius / The Ick project +... + + +# Introduction + +JT is a command line tool for writing entries in my personal journal. +It works by adding files to the git repository with the journal, for +formatting by the Ikiwiki website compiler. This +document presents its automated acceptance tests, using a (for now +hypothetical) language similar to the Gherkin langauge implemented by +Cucumber. + +All of these scenarios start with an empty directory and with JT +configured to put drafts in the `drafts` directory, topics in +`topics`, and finished journal entries in `notes`. + +# Happy path scenarios + +## Add a journal entry + +We start off with an empty journal repository. We only test that it's +empty here; all other scenarios assume this works. + +> *given* an empty journal repository +> *then* there is only **_.git_** in the journal repository + +We create a draft journal entry. + +> *when* I run `jt new "my title"` +> *then* **_drafts/0.mdwn_** exists +> *and* it contains **_"my title"_** + +When we finish the entry, the draft is moved to the notes directory. + +> *given* the date is **_2019-09-01_** +> *when* I run `jt finish` +> *then* **_notes/2019/09/01/my_title.mdwn_** exists +> *and* it contains **_"my title"_** + +## Add a journal entry with an attachment + +This is similar to adding a journal entry, except it adds an +attachment to the new entry. The attachment could be anything, such as +a photo. + +> *given* an empty journal repository +> *when* I run `jt new "my title"` +> *then* **_drafts/0.mdwn_** exists +> *and* it contains **_"my title"_** + +The attachment file needs to exist. It gets copied to the drafts +directory. + +> *given* the file `photo.jpg` exists +> *when* I run `jt attach 0 photo.jpg` +> *then* **_drafts/0/photo.jpg_** exists + +When we finish the entry, the draft is moved to the notes directory, +with the attachment. + +> *given* the date is **_2019-09-01_** +> *when* I run `jt finish` +> *then* **_notes/2019/09/01/my_title.mdwn_** exists +> *and* it contains **_"my title"_** +> *and* **_notes/2019/09/01/my_title/photo.jpg_** exists + + +## Add a topic + +JT allows "topic", which are meant to be pages that collect entries of +specific topics. The formatted journal will have a page for each topic +shows all entries that reference that topic. Similar to tags, but +another dimension of metadata. It's up to the user to use tags or +topics as they wish. + +> *given* an empty journal repository +> *when* I run `jt new-topic 2019/my-project` +> *then* **_topics/2019/my-project.mdwn_** exists + +One can add an entry for a topic, but it must exist. + +> *when* I run `jt new --topic nonexistent "my title"` +> *then* it fails +> *when* I run `jt new --topic 2019/my-project "my title"` +> *then* **drafts/0.mdwn_** exists +> *and* it contains **_"2019/my-project"_** + +# Unhappy path scenarios + +## Finishing when there's more than one draft + +JT will pick the draft to act on if there's only one current draft. If +there's more, it will fail with an error message saying "too many +drafts". + +> *given* an empty journal repository +> *when* I run `jt new "first"` +> *then* **drafts/0.mdwn_** exists +> *when* I run `jt new "second"` +> *then* **drafts/1.mdwn_** exists +> *when* I run `jt finish` +> *then* it fails with `"too many drafts"` + +## Attaching when there's no such draft + +Attaching to a draft that doesn't exist doesn't work. + +> *given* an empty journal repository +> *and* the file `photo.jpg` exists +> *when* I run `jt attach 0 photo.jpg` +> *then* it fails with `"no such draft"` + +## Attaching when there's no such file + +Attaching a file that doesn't exist doesn't work. + +> *given* an empty journal repository +> *when* I run `jt new "first"` +> *and* I run `jt attach 0 photo.jpg` +> *then* it fails with `"no such file"` diff --git a/muck1.pdf b/muck1.pdf Binary files differnew file mode 100644 index 0000000..14d064b --- /dev/null +++ b/muck1.pdf diff --git a/muck2.pdf b/muck2.pdf Binary files differnew file mode 100644 index 0000000..26b6c11 --- /dev/null +++ b/muck2.pdf diff --git a/muck3.pdf b/muck3.pdf Binary files differnew file mode 100644 index 0000000..d5f3401 --- /dev/null +++ b/muck3.pdf |