-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed Decider specification compatibility in browser
- Loading branch information
1 parent
ba04864
commit 7d41295
Showing
6 changed files
with
324 additions
and
9 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
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,27 @@ | ||
name: Playwright Tests | ||
on: | ||
push: | ||
branches: [ main, master ] | ||
pull_request: | ||
branches: [ main, master ] | ||
jobs: | ||
test: | ||
timeout-minutes: 60 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: lts/* | ||
- name: Install dependencies | ||
run: npm ci | ||
- name: Install Playwright Browsers | ||
run: npx playwright install --with-deps | ||
- name: Run Playwright tests | ||
run: npx playwright test | ||
- uses: actions/upload-artifact@v4 | ||
if: always() | ||
with: | ||
name: playwright-report | ||
path: playwright-report/ | ||
retention-days: 30 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
export const deepEquals = <T>(left: T, right: T): boolean => { | ||
if (isEquatable(left)) { | ||
return left.equals(right); | ||
} | ||
|
||
if (Array.isArray(left)) { | ||
return ( | ||
Array.isArray(right) && | ||
left.length === right.length && | ||
left.every((val, index) => deepEquals(val, right[index])) | ||
); | ||
} | ||
|
||
if ( | ||
typeof left !== 'object' || | ||
typeof right !== 'object' || | ||
left === null || | ||
right === null | ||
) { | ||
return left === right; | ||
} | ||
|
||
if (Array.isArray(right)) return false; | ||
|
||
const keys1 = Object.keys(left); | ||
const keys2 = Object.keys(right); | ||
|
||
if ( | ||
keys1.length !== keys2.length || | ||
!keys1.every((key) => keys2.includes(key)) | ||
) | ||
return false; | ||
|
||
for (const key in left) { | ||
if (left[key] instanceof Function && right[key] instanceof Function) | ||
continue; | ||
|
||
const isEqual = deepEquals(left[key], right[key]); | ||
if (!isEqual) { | ||
return false; | ||
} | ||
} | ||
|
||
return true; | ||
}; | ||
|
||
export type Equatable<T> = { equals: (right: T) => boolean } & T; | ||
|
||
export const isEquatable = <T>(left: T): left is Equatable<T> => { | ||
return ( | ||
left && | ||
typeof left === 'object' && | ||
'equals' in left && | ||
typeof left['equals'] === 'function' | ||
); | ||
}; |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from './deepEquals'; | ||
export * from './iterators'; | ||
export * from './merge'; | ||
|
||
|