How to use the spyOnEachPage function from aws-sdk

Find comprehensive JavaScript aws-sdk.spyOnEachPage code examples handpicked from public code repositorys.

124
125
126
127
128
129
130
131
132

describe('listing things', () => {
  afterEach(() => AWS.clearAllMocks());

  it('can mock .eachPage directly', async () => {
    const list = AWS.spyOnEachPage('S3', 'listObjectsV2', [
      { Contents: [1, 2, 3] },
      { Contents: [4, 5, 6] }
    ]);
fork icon3
star icon19
watch icon79

+ 7 other calls in file

121
122
123
124
125
126
127
128
129

  await expect(() => eachPager()).rejects.toThrow('foo');
});

it('demands you provide pages to mock .eachPage()', async () => {
  expect(() => AWS.spyOnEachPage('S3', 'listObjectsV2')).toThrow(
    'to mock .eachPage(), you must provide an array of pages'
  );
});
fork icon3
star icon19
watch icon79

+ 23 other calls in file

45
46
47
48
49
50
51
52
53
54
      Objects: [{ Key: 'test/path/1.txt' }, { Key: 'text/path/2.txt' }],
    },
  })
})
test('should show message when files not found', async () => {
  const listFiles = AWS.spyOnEachPage('S3', 'listObjectsV2', [])

  const deleteFiles = new Delete({
    ...baseParameters,
    digitalEnableSemver: false,
fork icon2
star icon10
watch icon3

+ 23 other calls in file