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

Side effects when creating 2 consecutive events #4

Closed
piercus opened this issue Oct 25, 2017 · 0 comments · Fixed by #5
Closed

Side effects when creating 2 consecutive events #4

piercus opened this issue Oct 25, 2017 · 0 comments · Fixed by #5

Comments

@piercus
Copy link
Contributor

piercus commented Oct 25, 2017

I think createEvent function is having side-effect

Scenario

  const createEvent = require('aws-event-mocks');
  
  const event1 = createEvent({
    template: 'aws:s3',
    merge: {
      Records: [{
        eventName: 'ObjectCreated:Put',
        s3: {
          bucket: {
            name: 'bucket1'
          },
          object: {
            key: 'key1'
          }
        }
      }]
    }
  });

  const event2 = createEvent({
    template: 'aws:s3',
    merge: {
      Records: [{
        eventName: 'ObjectCreated:Put',
        s3: {
          bucket: {
            name: 'bucket1'
          },
          object: {
            key: 'key2'
          }
        }
      }]
    }
  });

  console.log(event1.Records[0].s3.object.key);
  // return 'key2'

Expected

I would expect to return 'key1'

piercus added a commit to piercus/aws-event-mocks that referenced this issue Oct 25, 2017
piercus added a commit to piercus/aws-event-mocks that referenced this issue Oct 25, 2017
eahefnawy added a commit that referenced this issue Aug 30, 2018
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 a pull request may close this issue.

1 participant