Skip to content
This repository has been archived by the owner on May 19, 2020. It is now read-only.

Unit tests #2

Closed
dselman opened this issue Jan 7, 2019 · 10 comments
Closed

Unit tests #2

dselman opened this issue Jan 7, 2019 · 10 comments
Assignees
Labels
Difficulty: Medium Good First Issue :octocat: Good for newcomers Hacktoberfest by DigitalOcean and DEV Type: Tests 🧪 Test coverage

Comments

@dselman
Copy link
Contributor

dselman commented Jan 7, 2019

We need unit tests for the JSON <-> MD conversion

@jeromesimeon
Copy link
Member

Any thought about how those would be written? Using jest or more traditional mocha-style tests?

@jeromesimeon
Copy link
Member

Roundtrip tests would be useful. To answer my own question, jest seems like a fine choice. Here is a small example:

test('can roundtrip basic text', () => {
  const markdownText = 'This is some text.';
  const value = fromMarkdown.convert(markdownText);
  const markdownRound = toMarkdown.convert(value);
  expect(markdownRound).toEqual(markdownText);
});

Note that even that first test fails round-tripping:

  ● can roundtrip basic text

    expect(received).toEqual(expected) // deep equality

    Expected: "This is some text."
    Received: "This is some text.

    "

This may tie into some of the whitespace issues mentioned in accordproject/cicero-ui#43

@jolanglinais jolanglinais added the Hacktoberfest by DigitalOcean and DEV label Sep 14, 2019
@jolanglinais
Copy link
Member

Hacktoberfest:

This issue can provide for multiple pull requests.

@codingdefined
Copy link
Contributor

@irmerk I would like to work on it. Does the tests should be only on the JSON <-> MD conversion? What all scenarios should we consider for the testing, like all the buttons in the toolbar?

@jolanglinais
Copy link
Member

@codingdefined this would be great to pick up! Just keep aware of the changes we're making in PRs #114 and #117 over the next few days.

We're using the markdown-transform now, so the conversions are described more in that README. I think the more tests the better, essentially. Testing buttons, testing copy-pasting, testing adding a clause template... If you'd use the editor in X way, we should test X.

@jolanglinais
Copy link
Member

@codingdefined what is the status on this issue?

@codingdefined
Copy link
Contributor

@irmerk Created the pull request for the same.

@jolanglinais
Copy link
Member

As mentioned in #134, this issue can provide for many PRs, so I will open this up.

@jolanglinais
Copy link
Member

Please note the conversation in markdown-transform #117 for testing this repo.

@jolanglinais
Copy link
Member

Closing for accordproject/web-components#14

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Difficulty: Medium Good First Issue :octocat: Good for newcomers Hacktoberfest by DigitalOcean and DEV Type: Tests 🧪 Test coverage
Projects
None yet
Development

No branches or pull requests

4 participants