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 { 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';
|
||||
|
||||
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', () => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
const graph = new Graph(null!);
|
||||
const graph = createGraphWithoutContainer();
|
||||
expect(() =>
|
||||
new ModelXmlSerializer(graph.getDataModel()).import(xmlFromIssue178)
|
||||
).toThrow(new Error('Invalid x supplied.'));
|
||||
|
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
import { Graph } from '../../../src';
|
||||
import { Graph } from '../src';
|
||||
|
||||
// no need for a container, we don't check the view here
|
||||
export const createGraphWithoutContainer = (): Graph => new Graph(null!);
|
|
@ -15,7 +15,7 @@ limitations under the License.
|
|||
*/
|
||||
|
||||
import { expect, test } from '@jest/globals';
|
||||
import { createGraphWithoutPlugins } from './utils';
|
||||
import { createGraphWithoutPlugins } from '../../utils';
|
||||
|
||||
test('The "ConnectionHandler" plugin is not available', () => {
|
||||
const graph = createGraphWithoutPlugins();
|
||||
|
|
|
@ -15,7 +15,7 @@ limitations under the License.
|
|||
*/
|
||||
|
||||
import { describe, expect, test } from '@jest/globals';
|
||||
import { createGraphWithoutContainer } from './utils';
|
||||
import { createGraphWithoutContainer } from '../../utils';
|
||||
import { Cell, type CellStyle, Geometry } from '../../../src';
|
||||
|
||||
describe('insertEdge', () => {
|
||||
|
|
|
@ -15,7 +15,7 @@ limitations under the License.
|
|||
*/
|
||||
|
||||
import { test } from '@jest/globals';
|
||||
import { createGraphWithoutPlugins } from './utils';
|
||||
import { createGraphWithoutPlugins } from '../../utils';
|
||||
|
||||
test('The "PanningHandler" plugin is not available', () => {
|
||||
const graph = createGraphWithoutPlugins();
|
||||
|
|
|
@ -15,7 +15,7 @@ limitations under the License.
|
|||
*/
|
||||
|
||||
import { test } from '@jest/globals';
|
||||
import { createGraphWithoutPlugins } from './utils';
|
||||
import { createGraphWithoutPlugins } from '../../utils';
|
||||
import { Cell, CellState } from '../../../src';
|
||||
|
||||
test('The "TooltipHandler" plugin is not available', () => {
|
||||
|
|
|
@ -15,7 +15,7 @@ limitations under the License.
|
|||
*/
|
||||
|
||||
import { describe, expect, test } from '@jest/globals';
|
||||
import { createGraphWithoutContainer } from './utils';
|
||||
import { createGraphWithoutContainer } from '../../utils';
|
||||
import { type CellStyle, Geometry } from '../../../src';
|
||||
|
||||
describe('insertVertex', () => {
|
||||
|
|
Loading…
Reference in New Issue