Open lobbin opened 3 years ago
The tests of our project broke when we updated the dependencies. Can't really tell which one though :(
We have a sdk module looking like this:
const AWS = require('aws-sdk') AWS.config.update({ accessKeyId: process.env.AWS_ACCESSKEY_ID, secretAccessKey: process.env.AWS_ACCESSKEY_SECRET, region: process.env.AWS_REGION }) module.exports= { s3: new AWS.S3(), timestreamwrite: new AWS.TimestreamWrite({ apiVersion: '2018-11-01' }) <more exports> } module.exports.default = AWS
And after the latest updates, we're getting a TypeError on the constructor after we apply a mock function TypeError: AWS.TimestreamWrite is not a constructor
TypeError: AWS.TimestreamWrite is not a constructor
One of the shorter tests looks a bit like this:
when('the AWS scheduler calls the lambda function', async () => { AWSMock.mock('TimestreamWrite', 'writeRecords', (params, callback) => { paramsTimestream = params callback(null, {}) }) let statistics jest.isolateModules(() => { statistics = require('../../../endpoints/cron/statistics') }) await statistics({}, {functionName: 'jest'}) AWSMock.restore('TimestreamWrite', 'writeRecords') })
The tests of our project broke when we updated the dependencies. Can't really tell which one though :(
We have a sdk module looking like this:
And after the latest updates, we're getting a TypeError on the constructor after we apply a mock function
TypeError: AWS.TimestreamWrite is not a constructor
One of the shorter tests looks a bit like this: