test: refactor graph initialization (#288)
Use the graph initialization util function in the "serialization" tests.development
parent
1507490c72
commit
871e1c37d5
|
@ -15,7 +15,8 @@ limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { describe, expect, test } from '@jest/globals';
|
import { describe, expect, test } from '@jest/globals';
|
||||||
import { Cell, Codec, Geometry, Graph, GraphDataModel, Point } from '../../src';
|
import { createGraphWithoutContainer } from '../utils';
|
||||||
|
import { Cell, Codec, Geometry, GraphDataModel, Point } from '../../src';
|
||||||
import { getPrettyXml, parseXml } from '../../src/util/xmlUtils';
|
import { getPrettyXml, parseXml } from '../../src/util/xmlUtils';
|
||||||
|
|
||||||
type ModelExportOptions = {
|
type ModelExportOptions = {
|
||||||
|
@ -111,8 +112,7 @@ describe('import before the export (reproduce https://github.com/maxGraph/maxGra
|
||||||
});
|
});
|
||||||
|
|
||||||
test('use Graph - reproduced what is described in issue 178', () => {
|
test('use Graph - reproduced what is described in issue 178', () => {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
const graph = createGraphWithoutContainer();
|
||||||
const graph = new Graph(null!);
|
|
||||||
expect(() =>
|
expect(() =>
|
||||||
new ModelXmlSerializer(graph.getDataModel()).import(xmlFromIssue178)
|
new ModelXmlSerializer(graph.getDataModel()).import(xmlFromIssue178)
|
||||||
).toThrow(new Error('Invalid x supplied.'));
|
).toThrow(new Error('Invalid x supplied.'));
|
||||||
|
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Graph } from '../../../src';
|
import { Graph } from '../src';
|
||||||
|
|
||||||
// no need for a container, we don't check the view here
|
// no need for a container, we don't check the view here
|
||||||
export const createGraphWithoutContainer = (): Graph => new Graph(null!);
|
export const createGraphWithoutContainer = (): Graph => new Graph(null!);
|
|
@ -15,7 +15,7 @@ limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { expect, test } from '@jest/globals';
|
import { expect, test } from '@jest/globals';
|
||||||
import { createGraphWithoutPlugins } from './utils';
|
import { createGraphWithoutPlugins } from '../../utils';
|
||||||
|
|
||||||
test('The "ConnectionHandler" plugin is not available', () => {
|
test('The "ConnectionHandler" plugin is not available', () => {
|
||||||
const graph = createGraphWithoutPlugins();
|
const graph = createGraphWithoutPlugins();
|
||||||
|
|
|
@ -15,7 +15,7 @@ limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { describe, expect, test } from '@jest/globals';
|
import { describe, expect, test } from '@jest/globals';
|
||||||
import { createGraphWithoutContainer } from './utils';
|
import { createGraphWithoutContainer } from '../../utils';
|
||||||
import { Cell, type CellStyle, Geometry } from '../../../src';
|
import { Cell, type CellStyle, Geometry } from '../../../src';
|
||||||
|
|
||||||
describe('insertEdge', () => {
|
describe('insertEdge', () => {
|
||||||
|
|
|
@ -15,7 +15,7 @@ limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { test } from '@jest/globals';
|
import { test } from '@jest/globals';
|
||||||
import { createGraphWithoutPlugins } from './utils';
|
import { createGraphWithoutPlugins } from '../../utils';
|
||||||
|
|
||||||
test('The "PanningHandler" plugin is not available', () => {
|
test('The "PanningHandler" plugin is not available', () => {
|
||||||
const graph = createGraphWithoutPlugins();
|
const graph = createGraphWithoutPlugins();
|
||||||
|
|
|
@ -15,7 +15,7 @@ limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { test } from '@jest/globals';
|
import { test } from '@jest/globals';
|
||||||
import { createGraphWithoutPlugins } from './utils';
|
import { createGraphWithoutPlugins } from '../../utils';
|
||||||
import { Cell, CellState } from '../../../src';
|
import { Cell, CellState } from '../../../src';
|
||||||
|
|
||||||
test('The "TooltipHandler" plugin is not available', () => {
|
test('The "TooltipHandler" plugin is not available', () => {
|
||||||
|
|
|
@ -15,7 +15,7 @@ limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { describe, expect, test } from '@jest/globals';
|
import { describe, expect, test } from '@jest/globals';
|
||||||
import { createGraphWithoutContainer } from './utils';
|
import { createGraphWithoutContainer } from '../../utils';
|
||||||
import { type CellStyle, Geometry } from '../../../src';
|
import { type CellStyle, Geometry } from '../../../src';
|
||||||
|
|
||||||
describe('insertVertex', () => {
|
describe('insertVertex', () => {
|
||||||
|
|
Loading…
Reference in New Issue