-
Notifications
You must be signed in to change notification settings - Fork 176
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master' into #1990-functional-gr…
…oup-does-not-connect-with-another-functional-group-on-clickdrag
- Loading branch information
Showing
44 changed files
with
902 additions
and
1,129 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
packages/ketcher-core/__tests__/domain/entities/pile.test.ts
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,41 @@ | ||
import { Pile } from 'domain/entities/pile' | ||
|
||
describe('unionIntersections', () => { | ||
it('unions multiple sets which have intersections', () => { | ||
const setA = new Pile([0, 1]) | ||
const setB = new Pile([1, 2, 3]) | ||
const setC = new Pile([2, 3]) | ||
|
||
const union = Pile.unionIntersections([setA, setB, setC]) | ||
|
||
expect(union).toHaveLength(1) | ||
expect(union[0]).toEqual(new Pile([0, 1, 2, 3])) | ||
}) | ||
|
||
it('does not union sets which have no intersections', () => { | ||
const setA = new Pile([0, 1]) | ||
const setB = new Pile([2, 3]) | ||
|
||
const union = Pile.unionIntersections([setA, setB]) | ||
|
||
expect(union).toHaveLength(2) | ||
expect(union[0]).toEqual(setA) | ||
expect(union[1]).toEqual(setB) | ||
}) | ||
|
||
// Combines above two situations | ||
it('unions multiple sets which have intersections, and skips sets without intersections', () => { | ||
const setA = new Pile([0, 1]) | ||
const setB = new Pile([1, 2, 3]) | ||
const setC = new Pile([2, 3]) | ||
const setD = new Pile([4, 5]) | ||
const setE = new Pile([6]) | ||
|
||
const union = Pile.unionIntersections([setA, setB, setC, setD, setE]) | ||
|
||
expect(union).toHaveLength(3) | ||
expect(union[0]).toEqual(new Pile([0, 1, 2, 3])) | ||
expect(union[1]).toEqual(setD) | ||
expect(union[2]).toEqual(setE) | ||
}) | ||
}) |
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
Oops, something went wrong.