Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added unit tests for lib/markdown #1678

Merged
merged 10 commits into from
Mar 18, 2018

Conversation

rayou
Copy link
Contributor

@rayou rayou commented Mar 14, 2018

Added unit tests for the issues in recent releases.

@@ -1,10 +1,9 @@
const path = require('path')
const fs = require('sander')
const { remote } = require('electron')
const { app } = remote
Copy link
Contributor Author

@rayou rayou Mar 14, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't extract app from remote while running tests, following error throws.

var app = remote.app;
                ^

TypeError: Cannot read property 'app' of undefined

Any ideas why this happened?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume we have to make remote Mockable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As result, require('electron') just return the path of electron binary, a string.

I think it's an good idea to mock electron, so I created a new mock helper in tests/helpers/setup-electron-mock.js, we can add more mocked function into it if needed.

@@ -92,7 +92,7 @@
"uuid": "^3.2.1"
},
"devDependencies": {
"ava": "^0.16.0",
"ava": "^0.25.0",
Copy link
Contributor Author

@rayou rayou Mar 14, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

upgraded to 0.25.0 for snapshot support

@@ -29,5 +29,5 @@ test('RcParser should return a json object', t => {
})

function filePath (filename) {
return path.join('boostnoterc', filename)
return path.join(`${__dirname}/boostnoterc`, filename)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

breaking change in ava v0.17.0

@Rokt33r Rokt33r self-requested a review March 15, 2018 03:46

const noop = () => {}

mock('electron', {
Copy link
Contributor Author

@rayou rayou Mar 15, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added mock electron.

@@ -1,10 +1,9 @@
const path = require('path')
const fs = require('sander')
const { remote } = require('electron')
const { app } = remote
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As result, require('electron') just return the path of electron binary, a string.

I think it's an good idea to mock electron, so I created a new mock helper in tests/helpers/setup-electron-mock.js, we can add more mocked function into it if needed.

@rayou
Copy link
Contributor Author

rayou commented Mar 15, 2018

As result, require('electron') just return the path of electron binary, a string.

I think it's an good idea to mock electron, so I created a new mock helper in tests/helpers/setup-electron-mock.js, we can add more mocked function into it if needed.

The change in browser/lib/consts.js has been reverted.

@Rokt33r
Copy link
Member

Rokt33r commented Mar 15, 2018

Great work!! 👍 👍 👍

@Rokt33r Rokt33r added the awaiting review ❇️ Pull request is awaiting a review. label Mar 15, 2018
@rayou
Copy link
Contributor Author

rayou commented Mar 17, 2018

fixed conflicts.

@Rokt33r Rokt33r merged commit 222de03 into BoostIO:master Mar 18, 2018
@Rokt33r Rokt33r added next release (v0.11.3) and removed awaiting review ❇️ Pull request is awaiting a review. labels Mar 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants