Files
xod/packages/xod-project/test/comment.spec.js
Evgeny Kochetkov e6ab08e297 chore(infra): format code with prettier
Just `yarn lint  --fix`
2018-03-05 17:59:03 +03:00

66 lines
2.0 KiB
JavaScript

import { assert } from 'chai';
import * as XP from '../src';
describe('Comment', () => {
describe('createComment', () => {
it('should create Comment with specified position, size and content', () => {
const position = { x: 123, y: 456 };
const size = { width: 345, height: 678 };
const content = 'test comment content';
const comment = XP.createComment(position, size, content);
assert.deepEqual(XP.getCommentPosition(comment), position);
assert.deepEqual(XP.getCommentSize(comment), size);
assert.equal(XP.getCommentContent(comment), content);
});
});
describe('setters', () => {
const defaultComment = XP.createComment(
{ x: 0, y: 0 },
{ width: 0, height: 0 },
''
);
describe('setCommentId', () => {
it('should return a new Comment with a specified CommentId', () => {
const newId = 'new_id';
const newComment = XP.setCommentId(newId, defaultComment);
assert.deepEqual(XP.getCommentId(newComment), newId);
});
});
describe('setCommentPosition', () => {
it('should return a new Comment with a specified Position', () => {
const newPosition = { x: 321, y: 765 };
const newComment = XP.setCommentPosition(newPosition, defaultComment);
assert.deepEqual(XP.getCommentPosition(newComment), newPosition);
});
});
describe('setCommentSize', () => {
it('should return a new Comment with a specified Size', () => {
const newSize = { width: 888, height: 777 };
const newComment = XP.setCommentSize(newSize, defaultComment);
assert.deepEqual(XP.getCommentSize(newComment), newSize);
});
});
describe('setCommentContent', () => {
it('should return a new Comment with a specified Content', () => {
const newContent = 'newContent';
const newComment = XP.setCommentContent(newContent, defaultComment);
assert.deepEqual(XP.getCommentContent(newComment), newContent);
});
});
});
});