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

test: migrate common.js tests to tap #176

Closed
wants to merge 9 commits into from
Closed

test: migrate common.js tests to tap #176

wants to merge 9 commits into from

Conversation

nechaido
Copy link
Member

Also add sinon to dependencies.

tap.ok(common.safeRequire(existingModule), 'must require existing module');

tap.equal(common.safeRequire(nonExistingModule), null,
'must return \'null\' if module doesn\'t exist');
Copy link
Member

Choose a reason for hiding this comment

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

It will be better to avoid escaping by using backticks or double quotes here, but this is not mandatory.

Copy link
Member Author

Choose a reason for hiding this comment

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

@belochub currently eslint forbids to do so.

Copy link
Member

@belochub belochub left a comment

Choose a reason for hiding this comment

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

LGTM

@tshemsedinov
Copy link
Member

@metarhia/jstp-core I think we may merge /jstp/lib/common.js into metarhia/Common

Copy link
Member

@lundibundi lundibundi left a comment

Choose a reason for hiding this comment

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

LGTM

targetEventEmitter.on('renamedEvent', spy);

sourceEventEmitter.emit('testEvent');
test.assert(spy.called, 'event handler must be called');
Copy link
Member

Choose a reason for hiding this comment

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

Ain't it 'must have been called'?

Copy link
Member

Choose a reason for hiding this comment

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

@lundibundi it should have been if it was a sentence, but in this case it's just a test name. Look at the other assertions, they are written in the same style.

@nechaido nechaido removed the deps label May 26, 2017
Copy link
Member

@aqrln aqrln left a comment

Choose a reason for hiding this comment

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

LGTM with nits.

const targetEventEmitter = new events.EventEmitter();

common.forwardEvent(sourceEventEmitter, targetEventEmitter,
'testEvent', 'renamedEvent');
Copy link
Member

@aqrln aqrln May 26, 2017

Choose a reason for hiding this comment

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

The indentation is off here.


const common = require('../../lib/common');

const existingModule = 'tap';
Copy link
Member

Choose a reason for hiding this comment

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

Maybe it would be better to require a core module here, but this works for me too.

const common = require('../../lib/common');

const existingModule = 'tap';
const nonExistingModule = 'tp';
Copy link
Member

Choose a reason for hiding this comment

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

And it might be better to use something more explicitly non-existent like __not_a_module here.

const existingModule = 'tap';
const nonExistingModule = 'tp';
const existingModule = '../..';
const nonExistingModule = '__non_existinting_module__';
Copy link
Member

Choose a reason for hiding this comment

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

Typo: s/existinting/existing

@aqrln
Copy link
Member

aqrln commented May 29, 2017

@nechaido CI's failing:

Error: Cannot find module '../..'

@nechaido
Copy link
Member Author

@aqrln yea, I see it. Unfortunately I had no time to fix it until now.

@nechaido
Copy link
Member Author

@aqrln fixed.

nechaido added a commit that referenced this pull request May 29, 2017
PR-URL: #176
Refs: #145
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com>
Reviewed-By: Mykola Bilochub <nbelochub@gmail.com>
@nechaido
Copy link
Member Author

Landed in a842a5f.

@nechaido nechaido closed this May 29, 2017
@nechaido nechaido deleted the test-common branch May 29, 2017 17:52
belochub pushed a commit that referenced this pull request Jan 22, 2018
PR-URL: #176
Refs: #145
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com>
Reviewed-By: Mykola Bilochub <nbelochub@gmail.com>
belochub pushed a commit that referenced this pull request Jan 22, 2018
PR-URL: #176
Refs: #145
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com>
Reviewed-By: Mykola Bilochub <nbelochub@gmail.com>
@belochub belochub mentioned this pull request Jan 22, 2018
belochub pushed a commit to metarhia/mdsf that referenced this pull request Jul 19, 2018
PR-URL: metarhia/jstp#176
Refs: metarhia/jstp#145
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com>
Reviewed-By: Mykola Bilochub <nbelochub@gmail.com>
belochub pushed a commit to metarhia/mdsf that referenced this pull request Jul 21, 2018
PR-URL: metarhia/jstp#176
Refs: metarhia/jstp#145
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com>
Reviewed-By: Mykola Bilochub <nbelochub@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants