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

feat(cypress): add "match" custom assertion for subject, body, adresses, and headers #9

Merged
merged 3 commits into from
Jun 3, 2020

Conversation

Kocal
Copy link
Owner

@Kocal Kocal commented Jun 3, 2020

Q A
Bug fix? no
New feature? yes
Tests pass? yes
Fixed tickets #...

Added the possibility to match subject, body, addresses, and headers:

expect(messageEvents.events[0]).to.have.subject.match(/^Hello /);
expect(messageEvents.events[0]).to.have.subject.not.match(/^Goodbye/);

expect(messageEvents.events[0]).to.have.body('text').match('[a-z]+');
expect(messageEvents.events[0]).to.have.body('text').not.match('[a-z]+');

expect(messageEvents.events[0]).to.have.body('html').match('[a-z]+');
expect(messageEvents.events[0]).to.have.body('html').not.match('[a-z]+');

expect(messageEvents.events[0]).to.have.header('From').match(/[a-z]+@example.com/);
expect(messageEvents.events[0]).to.have.header('From').not.match(/[a-z0-9]+@example.com/);

expect(messageEvents.events[0]).to.have.address('From').match(/[a-z]+@example.com/);
expect(messageEvents.events[0]).to.have.address('From').not.match(/[a-z0-9]+@example.com);

@Kocal Kocal merged commit 9fc64c8 into master Jun 3, 2020
@Kocal Kocal deleted the feat/cypress-match branch June 3, 2020 11:41
This was referenced Jun 4, 2020
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.

1 participant