From a0f758c21347c386226f1cc22cf7489069efb0c8 Mon Sep 17 00:00:00 2001 From: ache Date: Wed, 7 Feb 2018 12:48:40 +0100 Subject: Add more tests --- __tests__/__snapshots__/index.js.md | 22 ++++----- __tests__/__snapshots__/index.js.snap | Bin 549 -> 564 bytes __tests__/index.js | 84 ++++++++++++++++++++++++++++++---- __tests__/mchoice.md | 7 +++ 4 files changed, 90 insertions(+), 23 deletions(-) diff --git a/__tests__/__snapshots__/index.js.md b/__tests__/__snapshots__/index.js.md index 3063a53..f67280e 100644 --- a/__tests__/__snapshots__/index.js.md +++ b/__tests__/__snapshots__/index.js.md @@ -4,26 +4,20 @@ The actual snapshot is saved in `index.js.snap`. Generated by [AVA](https://ava.li). -## mchoide +## mchoide-raw-snap > Snapshot 1 `

That is a multiple choice test :

␊ -
` +
␊ +

This is a HTML injected in a markdown file

␊ +
The plugin should not modify the HTML injected part
` -## mchoide-raw +## mchoide-snap > Snapshot 1 `

That is a multiple choice test :

␊ -
␊ -

This is a HTML injected in a markdown file

␊ -
The plugin should not modify the HTML injected part
` +
␊ +

And this is an other QCM :

␊ +
` diff --git a/__tests__/__snapshots__/index.js.snap b/__tests__/__snapshots__/index.js.snap index 0464d51..e58a82b 100644 Binary files a/__tests__/__snapshots__/index.js.snap and b/__tests__/__snapshots__/index.js.snap differ diff --git a/__tests__/index.js b/__tests__/index.js index df1e62f..59afa38 100644 --- a/__tests__/index.js +++ b/__tests__/index.js @@ -30,25 +30,91 @@ test('simple', t => { - [x] ! False - [ ] ~ None - [x] = True`); - t.is(contents, ''); + t.is(contents, +`
`); }); -test('mchoide', t => { +test('mchoide-snap', t => { const {contents} = render(file(join(__dirname, 'mchoice.md'))); t.snapshot(contents); }); -test('mchoide-raw', t => { +test('all-checked', t => { + const {contents} = render(` + - [x] ! False + - [x] ~ None + - [x] = True`); + t.is(contents, +`
`); +}); + +test('none-checked', t => { + const {contents} = render(` + - [ ] ! False + - [ ] ~ None + - [ ] = True`); + t.is(contents, +`
`); +}); + +test('caps-checked', t => { + const {contents} = render(` + - [X] ! False + - [X] ~ None + - [X] = True`); + t.is(contents, +`
`); +}); + +test('empty-square-check', t => { + const {contents} = render(` + - [] ! False + - [] ~ None + - [] = True`); + t.is(contents, +`
`); +}); + +test('multi-check', t => { + const {contents} = render(` + - [X] = caps + - [] ! empty + - [ ] ! space + - [x] = checkmark`); + t.is(contents, +`
`); +}); + +test('mchoide-raw-snap', t => { const {contents} = renderRaw(file(join(__dirname, 'mchoice-raw.md'))); t.snapshot(contents); }); -test.todo('all checked'); -test.todo('none checked'); -test.todo('caps checked'); -test.todo('enpty square brackets'); -test.todo('every kind of checked'); - test.todo('Citation in a multiple-choice'); test.todo('Feedback feature test'); diff --git a/__tests__/mchoice.md b/__tests__/mchoice.md index 8a4d65d..6b8298d 100644 --- a/__tests__/mchoice.md +++ b/__tests__/mchoice.md @@ -6,3 +6,10 @@ That is a multiple choice test : - [ ] ! It's still work ! - [ ] ~ It will work +And this is an other QCM : + + - [ ] ! The answer D + - [x] = That doesn't work *at the moment* + - [x] ! It's still work ! + - [x] ~ It will work + -- cgit v1.2.3