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

CI preparations #14

Merged
merged 6 commits into from
Mar 4, 2018
Merged

CI preparations #14

merged 6 commits into from
Mar 4, 2018

Conversation

Vittly
Copy link
Collaborator

@Vittly Vittly commented Feb 25, 2018

Addressed to #11 and #3

@Vittly
Copy link
Collaborator Author

Vittly commented Feb 25, 2018

BemRequest and other helpers should be covered under #10

index.js, BemModuleFactoryPlugin and BemDependency are more about webpack internals. I've not decided about writing unit test for them. May be e2e is enough

@Vittly
Copy link
Collaborator Author

Vittly commented Feb 25, 2018

@zxqfox @Yeti-or and @awinogradov can some of you check?

@Vittly
Copy link
Collaborator Author

Vittly commented Mar 2, 2018

I'll wait till sunday and merge. Please check if you can

() => (cell, naming) => {
expect(naming).toBe('[origin]');

return `${cell.layer}.blocks/${cell.entity.block}/${cell.entity.block}.${cell.tech}`;
Copy link
Member

Choose a reason for hiding this comment

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

file.naming.stringify doesnt work well?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I also mocked getter of naming (see few lines before - naming is simple string) so true bem/sdk.naming.*.stringify will fail.

Plugin doesn't use bem/sdk.* directly only through "helpers". After #10 we will remove helpers and such mocks won't be needed.

On the other side mocking of all dependencies is good for unit testing. Whole thing is tested by e2e

it('should filter nonexistent files', () => {
fs.existsSync.mockImplementation(path => {
switch (path) {
case 'dir/foo.js':
Copy link
Member

@qfox qfox Mar 3, 2018

Choose a reason for hiding this comment

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

Не хочешь оформить в виде hash?
const inMemoryFs = { dir: { 'foo.js': 'qwe' } }, и возвращать _.flat(inMemoryFs).hasOwnKey(path)

Ну или хотя бы return {'dir/foo.js': true, 'dir/foo.js': false}[path];

Switch выглядит громостко

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I like second:)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

For now fs.existsSync.mockImplementation(path => path === 'dir/foo.js'); is the smallest

@Vittly Vittly merged commit 57571b9 into master Mar 4, 2018
@Vittly Vittly deleted the unit-tests branch March 4, 2018 04:03
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