Repository: spotify/backstage
File: plugins/techdocs-node/src/stages/publish/awsS3.test.ts (TypeScript)

Code before:
      expect(await publisher.getReadiness()).toEqual({
        isAvailable: true,
      });
    });

    it('should reject incorrect config', async () => {
      const publisher = await createPublisherFromConfig({
        bucketName: 'errorBucket',
      });
      expect(await publisher.getReadiness()).toEqual({
        isAvailable: false,
      });
    });
  });

  describe('publish', () => {
    it('should publish a directory', async () => {
      const publisher = await createPublisherFromConfig();
      expect(await publisher.publish({ entity, directory })).toMatchObject({
        objects: expect.arrayContaining([
          'default/component/backstage/404.html',
          `default/component/backstage/index.html`,
          `default/component/backstage/assets/main.css`,
        ]),
      });
    }, 30000);

    it('should publish a directory as well when legacy casing is used', async () => {
      const publisher = await createPublisherFromConfig({
        legacyUseCaseSensitiveTripletPaths: true,
      });
      expect(await publisher.publish({ entity, directory })).toMatchObject({
        objects: expect.arrayContaining([
          'default/Component/backstage/404.html',
          `default/Component/backstage/index.html`,
          `default/Component/backstage/assets/main.css`,
        ]),
      });
    }, 30000);

    it('should publish a directory when root path is specified', async () => {
      const publisher = await createPublisherFromConfig({
        bucketRootPath: 'backstage-data/techdocs',
      });
      expect(await publisher.publish({ entity, directory })).toMatchObject({
        objects: expect.arrayContaining([
          'backstage-data/techdocs/default/component/backstage/404.html',
          `backstage-data/techdocs/default/component/backstage/index.html`,
          `backstage-data/techdocs/default/component/backstage/assets/main.css`,
        ]),
      });

Review comment (security):
were there any code changes that caused these tests to consistently need their timeouts bumped? this is quite a lot of timeout bumps for sensitive parts of the techdocs pipeline so I'm quite hesitant on these changes

Code after:
        legacyUseCaseSensitiveTripletPaths: true,
      });
      expect(await publisher.publish({ entity, directory })).toMatchObject({
        objects: expect.arrayContaining([
          'default/Component/backstage/404.html',
          `default/Component/backstage/index.html`,
          `default/Component/backstage/assets/main.css`,
        ]),
      });
    });

    it('should publish a directory when root path is specified', async () => {
      const publisher = await createPublisherFromConfig({
        bucketRootPath: 'backstage-data/techdocs',
      });
      expect(await publisher.publish({ entity, directory })).toMatchObject({
        objects: expect.arrayContaining([
          'backstage-data/techdocs/default/component/backstage/404.html',
          `backstage-data/techdocs/default/component/backstage/index.html`,
          `backstage-data/techdocs/default/component/backstage/assets/main.css`,
        ]),
      });
    });

    it('should publish a directory when root path is specified and legacy casing is used', async () => {
      const publisher = await createPublisherFromConfig({
        bucketRootPath: 'backstage-data/techdocs',
        legacyUseCaseSensitiveTripletPaths: true,
      });
      expect(await publisher.publish({ entity, directory })).toMatchObject({
        objects: expect.arrayContaining([
          'backstage-data/techdocs/default/Component/backstage/404.html',
          `backstage-data/techdocs/default/Component/backstage/index.html`,
          `backstage-data/techdocs/default/Component/backstage/assets/main.css`,
        ]),
      });
    });

    it('should publish a directory when sse is specified', async () => {
      const publisher = await createPublisherFromConfig({
        sse: 'aws:kms',
      });
      expect(await publisher.publish({ entity, directory })).toMatchObject({
        objects: expect.arrayContaining([
          'default/component/backstage/404.html',
          'default/component/backstage/index.html',
          'default/component/backstage/assets/main.css',
        ]),
      });
    });