-
Notifications
You must be signed in to change notification settings - Fork 177
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#197 - fix s-group attachment points protruding brackets and add unit…
… tests
- Loading branch information
1 parent
b9599cf
commit 7ed0263
Showing
6 changed files
with
81 additions
and
11 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
packages/ketcher-core/__tests__/application/editor/actions/bond.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
19 changes: 19 additions & 0 deletions
19
packages/ketcher-core/__tests__/application/render/restruct/rergroup.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,19 @@ | ||
import { ReRGroup, ReStruct } from 'application/render/restruct'; | ||
import { restruct } from '../../../mock-data'; | ||
import { RGroup } from 'domain/entities'; | ||
import { mock, mockFn } from 'jest-mock-extended'; | ||
import { Render } from 'src'; | ||
|
||
describe('rergroup should calculate R-Group bounding box correctly', () => { | ||
it('should calculate R-Group attachments points bounding box', () => { | ||
const render = mock<Render>(); | ||
render.ctab = { ...restruct.molecule } as unknown as ReStruct; | ||
const rGroup = new RGroup(); | ||
rGroup.frags.add(0); | ||
const rerGroup = new ReRGroup(rGroup); | ||
rerGroup.getAtoms = mockFn().mockReturnValue(restruct.molecule.atoms); | ||
const attachmentsSpy = jest.spyOn(render.ctab, 'getAttachmentsPointsVBox'); | ||
rerGroup.calcBBox(render); | ||
expect(attachmentsSpy).toHaveBeenCalled(); | ||
}); | ||
}); |
17 changes: 17 additions & 0 deletions
17
packages/ketcher-core/__tests__/domain/entities/sgroup.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,17 @@ | ||
import { ReStruct } from 'application/render/restruct'; | ||
import { restruct } from '../../mock-data'; | ||
import { SGroup } from 'domain/entities'; | ||
import { mock } from 'jest-mock-extended'; | ||
import { Render } from 'src'; | ||
|
||
describe('sgroup should calculate S-Group bounding box correctly', () => { | ||
it('should calculate S-Group attachments points bounding box', () => { | ||
const render = mock<Render>(); | ||
render.ctab = { ...restruct.molecule } as unknown as ReStruct; | ||
const sGroup = new SGroup('MUL'); | ||
sGroup.atoms = [0, 1, 2, 3, 4]; | ||
const attachmentsSpy = jest.spyOn(render.ctab, 'getAttachmentsPointsVBox'); | ||
SGroup.bracketPos(sGroup, restruct.molecule, {}, undefined, render); | ||
expect(attachmentsSpy).toHaveBeenCalled(); | ||
}); | ||
}); |
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