forked from opendatahub-io/odh-dashboard
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #299 from red-hat-data-services/main
Prepare 1.34 release (I)
- Loading branch information
Showing
26 changed files
with
732 additions
and
403 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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), | ||
), | ||
); | ||
}, | ||
}); |
Oops, something went wrong.