08-14-2018 19:39
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

08-14-2018 19:39
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
Hi,
If anyone is interested in applying TDD and Unit testing in general, let me know your thoughts about the repo in https://github.com/ihassin/fitbit-coachusa, that shows how to do so locally (using your favourite IDE) and then uploading the code to Fitbit Studio; all this in the hope that one day Fitbit will support a CLI to upload projects and releve us from the UI.
Comments welcome, fork it and make it better!
Thanks,
Itamar
08-15-2018 11:37
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

SunsetRunner
08-15-2018 11:37
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
@ihassin: I'll give it a closer look, thanks for sharing. In the meantime, can you add your project in our OSS repository please?

08-15-2018 18:00
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

08-15-2018 18:00
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Thank you Fred, I shall add it to that repo under "examples" as showing the bus times is not a true app, but just an example of how to get Jest working with the code.
I am looking forward to your and others' comments about my code as I am not an expert in any of this, just wanted to hack my way in to getting tests running in both dev and Fitbit environments.

08-22-2018 18:47 - edited 08-22-2018 18:50
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

08-22-2018 18:47 - edited 08-22-2018 18:50
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

08-23-2018 06:43
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

SunsetRunner
08-23-2018 06:43
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
@ihassin: I'm happy to tell you that we just release CLI tools.
08-23-2018 06:51
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

08-23-2018 06:51
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Thank you,
- Itamar

08-23-2018 06:55
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post



08-23-2018 06:55
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
With the release of our new CLI SDK tools, Jest integration is super simple. Pop the following in a jest.config.js:
module.exports = {
transform: {
".(t|j)sx?": "ts-jest",
},
moduleFileExtensions: [
"ts",
"tsx",
"js",
"jsx",
],
testRegex: ".*\\.test\\.(t|j)sx?$",
clearMocks: true,
restoreMocks: true,
testEnvironment: 'node',
};
And add "jest" and "ts-jest" to your devDependencies. "yarn test" should just work then and pick up .test.js files.
As for Fitbit APIs you want to mock out, use jest.mock('file-transfer') or similar, and then your actual application code can remain unmodified.
08-23-2018 14:53
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

08-23-2018 14:53
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Thanks Liam. All good stuff today 🙂

