Skip to content

Conversation

iaforek
Copy link

@iaforek iaforek commented Oct 4, 2017

Changed object properties to methods in order to get this to work with aws-sdk-mock. When running sls invoke test isOffline() will return false. Therefore, you must set IS_OFFFLINE=true as environment variable manually prior running test locally or you can add to your tests:

before((done) => {
    process.env.IS_OFFLINE = true;
    ...
    done();
});

and

after((done) => {
    delete process.env.IS_OFFLINE;
    ...
    done();
});

In the code use: docClient = dynamodb.doc() instead of const docClient = dynamodb.doc.
This will work with AWS, serverless offline and mocks.

Additionally, made ESLint changes.

Changed object properties to methods in order to get this to work with mocks. When running `sls invoke test` isOffline() will return false. Therefore, you must set IS_OFFFLINE=true as environment variable manually prior running test locally or you can add to your tests:

    before((done) => {
        process.env.IS_OFFLINE = true;
        ...
        done();
    });

and

    after((done) => {
        delete process.env.IS_OFFLINE;
        ...
        done();
    });

In the code use: `docClient = dynamodb.doc()` instead of `const docClient = dynamodb.doc`.
This will work with AWS, serverless offline and mocks.

Additionally, made ESLint changes.
@mystix mystix mentioned this pull request Jul 24, 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 this pull request may close these issues.

1 participant