diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2aebf1afd7..8823d696b3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -214,7 +214,6 @@ jobs: name: Cloud typecheck SLACK_WEBHOOK_URL: ${{ secrets.SLACK_TEST_REPORTER_WEBHOOK }} - # TODO(WEB-2537): Setup CodeCOV cloud-tests: runs-on: ubuntu-latest steps: @@ -227,6 +226,11 @@ jobs: restore-keys: ${{ runner.os }}-cloud-jest- # Only use 1 worker, so the other can be used for the proxy server under test. - run: yarn test:cloud --coverage --maxWorkers=1 + - uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + fail_ci_if_error: false + flags: cloud-tests pre: if: ${{ github.ref_name == 'main' || github.ref_name == 'releases/staging' }} diff --git a/codecov.yml b/codecov.yml index 217ff701eb..db921b0b00 100644 --- a/codecov.yml +++ b/codecov.yml @@ -28,6 +28,10 @@ flag_management: target: 50% individual_flags: - name: unit-tests + - name: cloud-tests + statuses: + - type: project + target: 80% comment: layout: flags diff --git a/functions/components/metaTagInjector.test.ts b/functions/components/metaTagInjector.test.ts new file mode 100644 index 0000000000..dd4d540c79 --- /dev/null +++ b/functions/components/metaTagInjector.test.ts @@ -0,0 +1,38 @@ +import { MetaTagInjector } from './metaTagInjector' + +test('should append meta tag to element', () => { + const element = { + append: jest.fn(), + } as unknown as Element + const property = 'property' + const content = 'content' + const injector = new MetaTagInjector({ + title: 'test', + url: 'testUrl', + image: 'testImage', + description: 'testDescription', + }) + injector.append(element, property, content) + expect(element.append).toHaveBeenCalledWith(``, { html: true }) + + injector.element(element) + expect(element.append).toHaveBeenCalledWith(``, { html: true }) + expect(element.append).toHaveBeenCalledWith(``, { + html: true, + }) + expect(element.append).toHaveBeenCalledWith(``, { html: true }) + expect(element.append).toHaveBeenCalledWith(``, { html: true }) + expect(element.append).toHaveBeenCalledWith(``, { html: true }) + expect(element.append).toHaveBeenCalledWith(``, { html: true }) + expect(element.append).toHaveBeenCalledWith(``, { html: true }) + expect(element.append).toHaveBeenCalledWith(``, { html: true }) + + expect(element.append).toHaveBeenCalledWith(``, { + html: true, + }) + expect(element.append).toHaveBeenCalledWith(``, { html: true }) + expect(element.append).toHaveBeenCalledWith(``, { html: true }) + expect(element.append).toHaveBeenCalledWith(``, { html: true }) + + expect(element.append).toHaveBeenCalledTimes(13) +})