mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-28 07:03:17 +08:00
test: Add packet test for title, accTitle, accDescr
This commit is contained in:
parent
96ae4a5967
commit
7ef61d58fd
@ -1,7 +1,7 @@
|
|||||||
import { db } from './db.js';
|
import { db } from './db.js';
|
||||||
import { parser } from './parser.js';
|
import { parser } from './parser.js';
|
||||||
|
|
||||||
const { clear, getPacket } = db;
|
const { clear, getPacket, getDiagramTitle, getAccTitle, getAccDescription } = db;
|
||||||
|
|
||||||
describe('packet diagrams', () => {
|
describe('packet diagrams', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
@ -16,13 +16,19 @@ describe('packet diagrams', () => {
|
|||||||
expect(getPacket()).toMatchInlineSnapshot('[]');
|
expect(getPacket()).toMatchInlineSnapshot('[]');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should handle diagram with data', () => {
|
it('should handle diagram with data and title', () => {
|
||||||
const str = `packet-beta
|
const str = `packet-beta
|
||||||
|
title Packet diagram
|
||||||
|
accTitle: Packet accTitle
|
||||||
|
accDescr: Packet accDescription
|
||||||
0-10: "test"
|
0-10: "test"
|
||||||
`;
|
`;
|
||||||
expect(() => {
|
expect(() => {
|
||||||
parser.parse(str);
|
parser.parse(str);
|
||||||
}).not.toThrow();
|
}).not.toThrow();
|
||||||
|
expect(getDiagramTitle()).toMatchInlineSnapshot('"Packet diagram"');
|
||||||
|
expect(getAccTitle()).toMatchInlineSnapshot('"Packet accTitle"');
|
||||||
|
expect(getAccDescription()).toMatchInlineSnapshot('"Packet accDescription"');
|
||||||
expect(getPacket()).toMatchInlineSnapshot(`
|
expect(getPacket()).toMatchInlineSnapshot(`
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
|
Loading…
x
Reference in New Issue
Block a user