Skip to content

Commit 880c527

Browse files
author
Igor Drobiazko
committed
Try with clone
1 parent b6085a7 commit 880c527

File tree

2 files changed

+29
-5
lines changed

2 files changed

+29
-5
lines changed

lib/actions/createEvent.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,15 @@ function processAction(msg, cfg) {
4242

4343
function emitData(data) {
4444
const id = data.id;
45-
data.calendarId = cfg.calendarId;
4645
console.log('Successfully created event with ID=' + id);
4746
console.log('Emitting data ...');
4847
console.log('---DATA---');
4948
console.log('%j', data);
5049
console.log('---MSG---');
5150
console.log('%j', messages.newMessageWithBody(data));
52-
let messageBody = {
53-
id,
54-
calendarId: cfg.calendarId
55-
};
51+
52+
let messageBody = _.cloneDeep(data);
53+
messageBody.calendarId = cfg.calendarId;
5654
console.log('Emitting data ...');
5755
self.emit('data', messages.newMessageWithBody(messageBody));
5856
}

spec/actions/createEvent.spec.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,19 @@ describe('Outlook Create Event', function test() {
3636
expect(calls.argsFor(1)[0]).toEqual('end');
3737
expect(calls.argsFor(0)[1].body).toEqual({
3838
id: 'testid12345',
39+
subject: 'Unit Test - Simple Event',
40+
body: {
41+
contentType: 'HTML',
42+
content: 'This is a test.'
43+
},
44+
start: {
45+
dateTime: '2017-05-19T18:00:00',
46+
timeZone: 'Central European Standard Time'
47+
},
48+
end: {
49+
dateTime: '2017-05-20T19:00:00',
50+
timeZone: 'Central European Standard Time'
51+
},
3952
calendarId: 'AAMkAGYyNmJlYjBmLTgwOWYtNGU0Mi04NW'
4053
});
4154
expect(scope1.isDone()).toBeTruthy();
@@ -66,6 +79,19 @@ describe('Outlook Create Event', function test() {
6679
expect(calls.argsFor(1)[0]).toEqual('end');
6780
expect(calls.argsFor(0)[1].body).toEqual({
6881
id: 'testid12345',
82+
subject: 'Unit Test - Simple Event',
83+
body: {
84+
contentType: 'HTML',
85+
content: 'This is a test.'
86+
},
87+
start: {
88+
dateTime: '2017-05-19T18:00:00',
89+
timeZone: 'Central European Standard Time'
90+
},
91+
end: {
92+
dateTime: '2017-05-20T19:00:00',
93+
timeZone: 'Central European Standard Time'
94+
},
6995
calendarId: 'AAMkAGYyNmJlYjBmLTgwOWYtNGU0Mi04NW'
7096
});
7197
expect(scope1.isDone()).toBeTruthy();

0 commit comments

Comments
 (0)