Skip to content

Commit

Permalink
Merge pull request #299 from red-hat-data-services/main
Browse files Browse the repository at this point in the history
Prepare 1.34 release (I)
  • Loading branch information
lucferbux authored Oct 6, 2023
2 parents fd1ce89 + 00a6200 commit b1ae20c
Show file tree
Hide file tree
Showing 26 changed files with 732 additions and 403 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/auto-add-issues-to-project.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Auto Add Issues to Tracking boards
on:
issues:
types:
- opened
jobs:
add-to-project:
name: Add issue to projects
runs-on: ubuntu-latest
steps:
- name: Generate github-app token
id: app-token
uses: getsentry/action-github-app-token@v2
with:
app_id: ${{ secrets.DEVOPS_APP_ID }}
private_key: ${{ secrets.DEVOPS_APP_PRIVATE_KEY }}
- uses: actions/add-to-project@v0.5.0
with:
project-url: https://github.com/orgs/opendatahub-io/projects/40
github-token: ${{ steps.app-token.outputs.token }}
- uses: actions/add-to-project@v0.5.0
with:
project-url: https://github.com/orgs/opendatahub-io/projects/45
github-token: ${{ steps.app-token.outputs.token }}
2 changes: 1 addition & 1 deletion .github/workflows/pr-close-image-delete.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Git checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: Install skopeo
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
matrix:
node-version: [18.x]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3.8.1
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/quay-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Git checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: Install skopeo
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/vuln_scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
name: Scan Files
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Run Trivy vulnerability scanner for filesystem
uses: aquasecurity/trivy-action@0.11.2
with:
Expand Down
2 changes: 2 additions & 0 deletions frontend/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,6 @@ module.exports = {

// A list of paths to snapshot serializer modules Jest should use for snapshot testing
snapshotSerializers: [],

setupFilesAfterEnv: ['<rootDir>/src/__tests__/unit/jest.setup.ts'],
};
6 changes: 3 additions & 3 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 29 additions & 0 deletions frontend/src/__tests__/unit/jest.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
declare namespace jest {
interface Expect {
isIdentityEqual<T>(expected: T): T;
}

interface Matchers<R, T> {
hookToBe(expected: unknown): R;
hookToStrictEqual(expected: unknown): R;
hookToHaveUpdateCount(expected: number): R;
hookToBeStable<
V extends T extends Pick<
import('~/__tests__/unit/testUtils/hooks').RenderHookResultExt<
infer Result,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
any
>,
'result'
>
? import('~/__tests__/unit/testUtils/hooks').BooleanValues<Result>
: never,
>(
expected?: V,
): R;
}

interface Expect {
isIdentityEqual(expected: unknown): AsymmetricMatcher;
}
}
62 changes: 62 additions & 0 deletions frontend/src/__tests__/unit/jest.setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import { JestAssertionError } from 'expect';
import {
BooleanValues,
RenderHookResultExt,
createComparativeValue,
} from '~/__tests__/unit/testUtils/hooks';

const tryExpect = (expectFn: () => void) => {
try {
expectFn();
} catch (e) {
const { matcherResult } = e as JestAssertionError;
if (matcherResult) {
return { ...matcherResult, message: () => matcherResult.message };
}
throw e;
}
return {
pass: true,
message: () => '',
};
};

expect.extend({
// custom asymmetric matchers

/**
* Checks that a value is what you expect.
* It uses Object.is to check strict equality.
*
* Usage:
* expect.isIdentifyEqual(...)
*/
isIdentityEqual: (actual, expected) => ({
pass: Object.is(actual, expected),
message: () => `expected ${actual} to be identity equal to ${expected}`,
}),

// hook related custom matchers
hookToBe: (actual: RenderHookResultExt<unknown, unknown>, expected) =>
tryExpect(() => expect(actual.result.current).toBe(expected)),

hookToStrictEqual: (actual: RenderHookResultExt<unknown, unknown>, expected) =>
tryExpect(() => expect(actual.result.current).toStrictEqual(expected)),

hookToHaveUpdateCount: (actual: RenderHookResultExt<unknown, unknown>, expected: number) =>
tryExpect(() => expect(actual.getUpdateCount()).toBe(expected)),

hookToBeStable: <R>(actual: RenderHookResultExt<R, unknown>, expected?: BooleanValues<R>) => {
if (actual.getUpdateCount() <= 1) {
throw new Error('Cannot assert stability as the hook has not run at least 2 times.');
}
if (typeof expected === 'undefined') {
return tryExpect(() => expect(actual.result.current).toBe(actual.getPreviousResult()));
}
return tryExpect(() =>
expect(actual.result.current).toStrictEqual(
createComparativeValue(actual.getPreviousResult(), expected),
),
);
},
});
Loading

0 comments on commit b1ae20c

Please sign in to comment.