Skip to content

Commit

Permalink
add unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
uidp committed Jun 13, 2024
1 parent ceb877c commit 5e6273c
Showing 1 changed file with 47 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { ObjectId } from '@mikro-orm/mongodb';
import { BoardExternalReference, BoardExternalReferenceType, BoardLayout } from '../types';
import { MediaBoardNodeFactory } from './media-board-node-factory';
import { MediaBoardColors } from './types';

describe(MediaBoardNodeFactory.name, () => {
const setup = () => {
const factory = new MediaBoardNodeFactory();
const context: BoardExternalReference = {
id: new ObjectId().toHexString(),
type: BoardExternalReferenceType.User,
};
const layout = BoardLayout.GRID;
const backgroundColor = MediaBoardColors.BLUE;

return { factory, context, layout, backgroundColor };
};

it('build media board', () => {
const { factory, context, layout, backgroundColor } = setup();

const mediaBoard = factory.buildMediaBoard({
context,
layout,
backgroundColor,
collapsed: false,
});

expect(mediaBoard).toBeDefined();
});

it('build media line', () => {
const { factory, backgroundColor } = setup();

const mediaLine = factory.buildMediaLine({ title: 'media line', backgroundColor, collapsed: true });

expect(mediaLine).toBeDefined();
});

it('build external tool element', () => {
const { factory } = setup();

const toolElement = factory.buildExternalToolElement({ contextExternalToolId: new ObjectId().toHexString() });

expect(toolElement).toBeDefined();
});
});

0 comments on commit 5e6273c

Please sign in to comment.