-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dceef23
commit a020c07
Showing
16 changed files
with
295 additions
and
27 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
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
49 changes: 49 additions & 0 deletions
49
apps/server/src/shared/domain/domainobject/board/external-tool-element.do.spec.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,49 @@ | ||
import { createMock } from '@golevelup/ts-jest'; | ||
import { ObjectId } from '@mikro-orm/mongodb'; | ||
import { externalToolElementFactory } from '@shared/testing'; | ||
import { ExternalToolElement } from './external-tool-element.do'; | ||
import { BoardCompositeVisitor, BoardCompositeVisitorAsync } from './types'; | ||
|
||
describe(ExternalToolElement.name, () => { | ||
describe('when trying to add a child to a external tool element', () => { | ||
it('should throw an error ', () => { | ||
const externalToolElement = externalToolElementFactory.build(); | ||
const externalToolElementChild = externalToolElementFactory.build(); | ||
|
||
expect(() => externalToolElement.addChild(externalToolElementChild)).toThrow(); | ||
}); | ||
}); | ||
|
||
describe('update contextExternalToolId', () => { | ||
it('should be able to update contextExternalToolId', () => { | ||
const externalToolElement = externalToolElementFactory.build(); | ||
const contextExternalToolId = new ObjectId().toHexString(); | ||
|
||
externalToolElement.contextExternalToolId = contextExternalToolId; | ||
|
||
expect(externalToolElement.contextExternalToolId).toEqual(contextExternalToolId); | ||
}); | ||
}); | ||
|
||
describe('accept', () => { | ||
it('should call the right visitor method', () => { | ||
const visitor = createMock<BoardCompositeVisitor>(); | ||
const externalToolElement = externalToolElementFactory.build(); | ||
|
||
externalToolElement.accept(visitor); | ||
|
||
expect(visitor.visitExternalToolElement).toHaveBeenCalledWith(externalToolElement); | ||
}); | ||
}); | ||
|
||
describe('acceptAsync', () => { | ||
it('should call the right async visitor method', async () => { | ||
const visitor = createMock<BoardCompositeVisitorAsync>(); | ||
const externalToolElement = externalToolElementFactory.build(); | ||
|
||
await externalToolElement.acceptAsync(visitor); | ||
|
||
expect(visitor.visitExternalToolElementAsync).toHaveBeenCalledWith(externalToolElement); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.