-
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
c00d4cf
commit fa1afe8
Showing
8 changed files
with
432 additions
and
0 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
apps/server/src/modules/board/domain/collaborative-text-editor.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,35 @@ | ||
import { CollaborativeTextEditorElement, isCollaborativeTextEditorElement } from './collaborative-text-editor.do'; | ||
import { BoardNodeProps } from './types'; | ||
|
||
describe('CollaborativeTextEditorElement', () => { | ||
let collaborativeTextEditorElement: CollaborativeTextEditorElement; | ||
|
||
const boardNodeProps: BoardNodeProps = { | ||
id: '1', | ||
path: '', | ||
level: 1, | ||
position: 1, | ||
children: [], | ||
createdAt: new Date(), | ||
updatedAt: new Date(), | ||
}; | ||
|
||
beforeEach(() => { | ||
collaborativeTextEditorElement = new CollaborativeTextEditorElement({ | ||
...boardNodeProps, | ||
children: [], | ||
}); | ||
}); | ||
|
||
it('should be instance of CollaborativeTextEditorElement', () => { | ||
expect(isCollaborativeTextEditorElement(collaborativeTextEditorElement)).toBe(true); | ||
}); | ||
|
||
it('should not be instance of CollaborativeTextEditorElement', () => { | ||
expect(isCollaborativeTextEditorElement({})).toBe(false); | ||
}); | ||
|
||
it('should not have child', () => { | ||
expect(collaborativeTextEditorElement.canHaveChild()).toBe(false); | ||
}); | ||
}); |
44 changes: 44 additions & 0 deletions
44
apps/server/src/modules/board/domain/drawing-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,44 @@ | ||
import { DrawingElement, isDrawingElement } from './drawing-element.do'; | ||
import { BoardNodeProps } from './types'; | ||
|
||
describe('DrawingElement', () => { | ||
let drawingElement: DrawingElement; | ||
|
||
const boardNodeProps: BoardNodeProps = { | ||
id: '1', | ||
path: '', | ||
level: 1, | ||
position: 1, | ||
children: [], | ||
createdAt: new Date(), | ||
updatedAt: new Date(), | ||
}; | ||
|
||
beforeEach(() => { | ||
drawingElement = new DrawingElement({ | ||
...boardNodeProps, | ||
description: 'Test description', | ||
}); | ||
}); | ||
|
||
it('should be instance of DrawingElement', () => { | ||
expect(isDrawingElement(drawingElement)).toBe(true); | ||
}); | ||
|
||
it('should not be instance of DrawingElement', () => { | ||
expect(isDrawingElement({})).toBe(false); | ||
}); | ||
|
||
it('should return description', () => { | ||
expect(drawingElement.description).toBe('Test description'); | ||
}); | ||
|
||
it('should set description', () => { | ||
drawingElement.description = 'New description'; | ||
expect(drawingElement.description).toBe('New description'); | ||
}); | ||
|
||
it('should not have child', () => { | ||
expect(drawingElement.canHaveChild()).toBe(false); | ||
}); | ||
}); |
44 changes: 44 additions & 0 deletions
44
apps/server/src/modules/board/domain/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,44 @@ | ||
import { ExternalToolElement, isExternalToolElement } from './external-tool-element.do'; | ||
import { BoardNodeProps } from './types'; | ||
|
||
describe('ExternalToolElement', () => { | ||
let externalToolElement: ExternalToolElement; | ||
|
||
const boardNodeProps: BoardNodeProps = { | ||
id: '1', | ||
path: '', | ||
level: 1, | ||
position: 1, | ||
children: [], | ||
createdAt: new Date(), | ||
updatedAt: new Date(), | ||
}; | ||
|
||
beforeEach(() => { | ||
externalToolElement = new ExternalToolElement({ | ||
...boardNodeProps, | ||
contextExternalToolId: 'test-id', | ||
}); | ||
}); | ||
|
||
it('should be instance of ExternalToolElement', () => { | ||
expect(isExternalToolElement(externalToolElement)).toBe(true); | ||
}); | ||
|
||
it('should not be instance of ExternalToolElement', () => { | ||
expect(isExternalToolElement({})).toBe(false); | ||
}); | ||
|
||
it('should return contextExternalToolId', () => { | ||
expect(externalToolElement.contextExternalToolId).toBe('test-id'); | ||
}); | ||
|
||
it('should set contextExternalToolId', () => { | ||
externalToolElement.contextExternalToolId = 'new-id'; | ||
expect(externalToolElement.contextExternalToolId).toBe('new-id'); | ||
}); | ||
|
||
it('should not have child', () => { | ||
expect(externalToolElement.canHaveChild()).toBe(false); | ||
}); | ||
}); |
54 changes: 54 additions & 0 deletions
54
apps/server/src/modules/board/domain/file-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,54 @@ | ||
import { FileElement, isFileElement } from './file-element.do'; | ||
import { BoardNodeProps } from './types'; | ||
|
||
describe('FileElement', () => { | ||
let fileElement: FileElement; | ||
|
||
const boardNodeProps: BoardNodeProps = { | ||
id: '1', | ||
path: '', | ||
level: 1, | ||
position: 1, | ||
children: [], | ||
createdAt: new Date(), | ||
updatedAt: new Date(), | ||
}; | ||
|
||
beforeEach(() => { | ||
fileElement = new FileElement({ | ||
...boardNodeProps, | ||
alternativeText: 'Test alt text', | ||
caption: 'Test caption', | ||
}); | ||
}); | ||
|
||
it('should be instance of FileElement', () => { | ||
expect(isFileElement(fileElement)).toBe(true); | ||
}); | ||
|
||
it('should not be instance of FileElement', () => { | ||
expect(isFileElement({})).toBe(false); | ||
}); | ||
|
||
it('should return alternativeText', () => { | ||
expect(fileElement.alternativeText).toBe('Test alt text'); | ||
}); | ||
|
||
it('should set alternativeText', () => { | ||
fileElement.alternativeText = 'New alt text'; | ||
expect(fileElement.alternativeText).toBe('New alt text'); | ||
}); | ||
|
||
it('should return caption', () => { | ||
expect(fileElement.caption).toBe('Test caption'); | ||
}); | ||
|
||
it('should set caption', () => { | ||
fileElement.caption = 'New caption'; | ||
expect(fileElement.caption).toBe('New caption'); | ||
}); | ||
|
||
it('should not have child', () => { | ||
expect(fileElement.canHaveChild()).toBe(false); | ||
}); | ||
}); |
74 changes: 74 additions & 0 deletions
74
apps/server/src/modules/board/domain/link-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,74 @@ | ||
import { LinkElement, isLinkElement } from './link-element.do'; | ||
import { BoardNodeProps } from './types/board-node-props'; | ||
|
||
describe('LinkElement', () => { | ||
let linkElement: LinkElement; | ||
|
||
const boardNodeProps: BoardNodeProps = { | ||
id: '1', | ||
path: '', | ||
level: 1, | ||
position: 1, | ||
children: [], | ||
createdAt: new Date(), | ||
updatedAt: new Date(), | ||
}; | ||
|
||
beforeEach(() => { | ||
linkElement = new LinkElement({ | ||
...boardNodeProps, | ||
url: 'https://example.com', | ||
title: 'Example', | ||
description: 'Example description', | ||
imageUrl: 'https://example.com/image.jpg', | ||
}); | ||
}); | ||
|
||
it('should be instance of LinkElement', () => { | ||
expect(isLinkElement(linkElement)).toBe(true); | ||
}); | ||
|
||
it('should not be instance of LinkElement', () => { | ||
expect(isLinkElement({})).toBe(false); | ||
}); | ||
|
||
it('should return url', () => { | ||
expect(linkElement.url).toBe('https://example.com'); | ||
}); | ||
|
||
it('should set url', () => { | ||
linkElement.url = 'https://newurl.com'; | ||
expect(linkElement.url).toBe('https://newurl.com'); | ||
}); | ||
|
||
it('should return title', () => { | ||
expect(linkElement.title).toBe('Example'); | ||
}); | ||
|
||
it('should set title', () => { | ||
linkElement.title = 'New title'; | ||
expect(linkElement.title).toBe('New title'); | ||
}); | ||
|
||
it('should return description', () => { | ||
expect(linkElement.description).toBe('Example description'); | ||
}); | ||
|
||
it('should set description', () => { | ||
linkElement.description = 'New description'; | ||
expect(linkElement.description).toBe('New description'); | ||
}); | ||
|
||
it('should return imageUrl', () => { | ||
expect(linkElement.imageUrl).toBe('https://example.com/image.jpg'); | ||
}); | ||
|
||
it('should set imageUrl', () => { | ||
linkElement.imageUrl = 'https://newurl.com/newimage.jpg'; | ||
expect(linkElement.imageUrl).toBe('https://newurl.com/newimage.jpg'); | ||
}); | ||
|
||
it('should not have child', () => { | ||
expect(linkElement.canHaveChild()).toBe(false); | ||
}); | ||
}); |
39 changes: 39 additions & 0 deletions
39
apps/server/src/modules/board/domain/media-board/media-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,39 @@ | ||
import { MediaExternalToolElement, isMediaExternalToolElement } from './media-external-tool-element.do'; | ||
import { BoardNodeProps } from '../types'; | ||
|
||
describe('MediaExternalToolElement', () => { | ||
let mediaExternalToolElement: MediaExternalToolElement; | ||
|
||
const boardNodeProps: BoardNodeProps = { | ||
id: '1', | ||
path: '', | ||
level: 1, | ||
position: 1, | ||
children: [], | ||
createdAt: new Date(), | ||
updatedAt: new Date(), | ||
}; | ||
|
||
beforeEach(() => { | ||
mediaExternalToolElement = new MediaExternalToolElement({ | ||
...boardNodeProps, | ||
contextExternalToolId: 'test-id', | ||
}); | ||
}); | ||
|
||
it('should be instance of MediaExternalToolElement', () => { | ||
expect(isMediaExternalToolElement(mediaExternalToolElement)).toBe(true); | ||
}); | ||
|
||
it('should not be instance of MediaExternalToolElement', () => { | ||
expect(isMediaExternalToolElement({})).toBe(false); | ||
}); | ||
|
||
it('should return contextExternalToolId', () => { | ||
expect(mediaExternalToolElement.contextExternalToolId).toBe('test-id'); | ||
}); | ||
|
||
it('should not have child', () => { | ||
expect(mediaExternalToolElement.canHaveChild()).toBe(false); | ||
}); | ||
}); |
55 changes: 55 additions & 0 deletions
55
apps/server/src/modules/board/domain/rich-text-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,55 @@ | ||
import { InputFormat } from '@shared/domain/types'; | ||
import { RichTextElement, isRichTextElement } from './rich-text-element.do'; | ||
import { BoardNodeProps } from './types'; | ||
|
||
describe('RichTextElement', () => { | ||
let richTextElement: RichTextElement; | ||
|
||
const boardNodeProps: BoardNodeProps = { | ||
id: '1', | ||
path: '', | ||
level: 1, | ||
position: 1, | ||
children: [], | ||
createdAt: new Date(), | ||
updatedAt: new Date(), | ||
}; | ||
|
||
beforeEach(() => { | ||
richTextElement = new RichTextElement({ | ||
...boardNodeProps, | ||
text: 'Test text', | ||
inputFormat: InputFormat.RICH_TEXT_CK5, | ||
}); | ||
}); | ||
|
||
it('should be instance of RichTextElement', () => { | ||
expect(isRichTextElement(richTextElement)).toBe(true); | ||
}); | ||
|
||
it('should not be instance of RichTextElement', () => { | ||
expect(isRichTextElement({})).toBe(false); | ||
}); | ||
|
||
it('should return text', () => { | ||
expect(richTextElement.text).toBe('Test text'); | ||
}); | ||
|
||
it('should set text', () => { | ||
richTextElement.text = 'New text'; | ||
expect(richTextElement.text).toBe('New text'); | ||
}); | ||
|
||
it('should return inputFormat', () => { | ||
expect(richTextElement.inputFormat).toBe(InputFormat.RICH_TEXT_CK5); | ||
}); | ||
|
||
it('should set inputFormat', () => { | ||
richTextElement.inputFormat = InputFormat.PLAIN_TEXT; | ||
expect(richTextElement.inputFormat).toBe(InputFormat.PLAIN_TEXT); | ||
}); | ||
|
||
it('should not have child', () => { | ||
expect(richTextElement.canHaveChild()).toBe(false); | ||
}); | ||
}); |
Oops, something went wrong.