Skip to content
This repository has been archived by the owner on Apr 28, 2022. It is now read-only.

Write more unit tests! #17

Open
10 of 27 tasks
freaktechnik opened this issue Oct 30, 2016 · 3 comments
Open
10 of 27 tasks

Write more unit tests! #17

freaktechnik opened this issue Oct 30, 2016 · 3 comments

Comments

@freaktechnik
Copy link
Member

freaktechnik commented Oct 30, 2016

Currently only very little functionality is tested. If there is already a test file some potential unit tests are marked using the test.todo() function.

More generic things that need to be done for easier testing:

  • Write a mock for the promisified github client to test all the API calling stuff, luckily all classes that call GitHub take the promisified GitHub Client as a construction argument, so actually testing them should be straight forward.
  • Test at least getRemainingChars() and tweetTooLong() on TwitterAccount [lib/twitter-account.js]
  • Test lib/data-store.js
  • Test the enhanced date object from lib/scheduled-date.js
  • Test the lib/async-event-emitter.js that chains async handlers.
  • Test lib/data-store-holder.js
  • Test lib/twitter-acount.js instance
  • Test lib/pagination.js
  • Test lib/issues.js data stores and events
  • Test lib/column.js
  • Test lib/board.js
  • Test lib/repo.js setup
  • Test lib/sources/
    • Test lib/sources/manager.js
    • Test lib/sources/source.js
    • Test lib/sources/discourse.js
    • Test lib/sources/events.js
    • Test lib/sources/issues.js
    • Test lib/sources/mentions.js
    • Test lib/sources/reminder.js
    • Test lib/sources/squad.js
    • Test lib/sources/tweeting.js
  • Test lib/content-queue.js
  • Test lib/discourse-threads.js
  • Test lib/reps-event.js
  • Test lib/twitter-account.js events
  • Test lib/tweet-card-content.js errors
@freaktechnik
Copy link
Member Author

The unit tests use ava, a modern test runner. To learn more about ava, visit its repo: https://github.com/avajs/ava

All the suggested unit tests are calls to the todo() method on test. To implement a test, remove the .todo and add a function as the second argument that will run as test. You get an argument on which you can make assertions. There is always at least one test implemented in a file, so you have a rough reference of how ava works (and to satisfy eslint).

@freaktechnik
Copy link
Member Author

It seems that the github client can take the token as token for testing.

@freaktechnik
Copy link
Member Author

I've started _stubs.js as a collection for stubs of objects used within the application. New ones should probably be available via that module, but not necessarily defined within the module, depending on complexity.

@freaktechnik freaktechnik added this to Basics in Areas Oct 16, 2017
@freaktechnik freaktechnik moved this from Basics to Unit tests in Areas Oct 16, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Areas
Unit tests
Development

No branches or pull requests

1 participant