-
Notifications
You must be signed in to change notification settings - Fork 780
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #812 from valtlfelipe/fix-parser
Fix parser constructor error when passing payload
- Loading branch information
Showing
3 changed files
with
26 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ const Parse = require('./parser'); | |
|
||
describe('test_parse', () => { | ||
describe('test_parse_key_values', () => { | ||
it('should return the key values specified in the config from the payload', () => { | ||
it('should return the key values specified in the config from the body', () => { | ||
const config = { | ||
keys: ['to', 'from'], | ||
}; | ||
|
@@ -24,6 +24,29 @@ describe('test_parse', () => { | |
expect(keyValues).to.be.an('object'); | ||
expect(keyValues).to.deep.equal(expectedValues); | ||
}); | ||
|
||
it('should return the key values specified in the config from the payload', () => { | ||
const config = { | ||
keys: ['to', 'from'], | ||
}; | ||
const request = { | ||
payload: { | ||
to: '[email protected]', | ||
from: 'Test User <[email protected]>', | ||
subject: 'Test Subject', | ||
}, | ||
}; | ||
|
||
const parse = new Parse(config, request); | ||
const keyValues = parse.keyValues(); | ||
const expectedValues = { | ||
to: '[email protected]', | ||
from: 'Test User <[email protected]>', | ||
}; | ||
|
||
expect(keyValues).to.be.an('object'); | ||
expect(keyValues).to.deep.equal(expectedValues); | ||
}); | ||
}); | ||
|
||
describe('test_parse_get_raw_email', () => { | ||
|