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

Add 2 test cases for URL blocking #1577

Merged

Conversation

weiwei-lin
Copy link
Contributor

Ensure adding blocked URL patterns works correctly.

@@ -222,6 +225,28 @@ describe('GatherRunner', function() {
});
});

it('tells the driver to block given URL patterns when blockedUrlPatterns is given', () => {
const receivedUrlPatterns = [];
const urlPatterns = ['http://*.evil.com', '.jpg', '.woff2'];
Copy link
Member

Choose a reason for hiding this comment

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

".jpg" is equivalent to ".jpg" ?? if so, i didn't know that. :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. They are the same. I was also surprised.

});

return GatherRunner.setupDriver(driver, {flags: {blockedUrlPatterns: urlPatterns.slice()}})
.then(() => assert.equal(receivedUrlPatterns.sort().join(), urlPatterns.sort().join()));
Copy link
Member

Choose a reason for hiding this comment

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

not sure if assert.equal means much on these arrays. do we need deepEqual or deepStrictEqual ? /me shrugs.

Copy link
Contributor Author

@weiwei-lin weiwei-lin Jan 30, 2017

Choose a reason for hiding this comment

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

I'm not comparing arrays here. I sort them and join the elements as a string respectively, then compare the strings. But yeah, deepStrictEqual seems better. Thx for your advice.

@paulirish paulirish merged commit e877dee into GoogleChrome:master Jan 31, 2017
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.

None yet

2 participants