Last active
October 3, 2017 18:41
-
-
Save mlimaloureiro/624587f7d9b34d7165de6830a75f297c to your computer and use it in GitHub Desktop.
transformation
This file contains hidden or 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
'use strict'; | |
const index = require('./index.js'); | |
const payloadFromUniplaces = { | |
"id": "57524918-54c7-4244-8d43-7144ccc5011a", | |
"event_name": "accommodation_provider_profile_updated", | |
"accommodation_provider_id": "cbc884c3-cb55-4f5d-a0a5-8eb598684f11", | |
"profile": { | |
"name": "miguel", | |
"email_address": { | |
"email_address": "[email protected]" | |
} | |
}, | |
"timestamp": "2017-01-31 14:15:50" | |
} | |
describe('transformations', () => { | |
test('it transforms ap profile', () => { | |
let actual = index.transform(payloadFromUniplaces); | |
let expected = "{\"id\":\"57524918-54c7-4244-8d43-7144ccc5011a\",\"event_name\":\"accommodation_provider_updated_name\",\"accommodation_provider_id\":\"cbc884c3-cb55-4f5d-a0a5-8eb598684f11\",\"field\":\"name\",\"value\":\"miguel\",\"timestamp\":\"2017-01-31 14:15:50\"}\n{\"id\":\"57524918-54c7-4244-8d43-7144ccc5011a\",\"event_name\":\"accommodation_provider_updated_email_address\",\"accommodation_provider_id\":\"cbc884c3-cb55-4f5d-a0a5-8eb598684f11\",\"field\":\"email_address\",\"value\":\"[email protected]\",\"timestamp\":\"2017-01-31 14:15:50\"}\n" | |
expect(actual).toEqual(expected); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment