2023-10-23 07:13:17 -05:00
|
|
|
/////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// pgAdmin 4 - PostgreSQL Tools
|
|
|
|
//
|
2024-01-01 02:43:48 -06:00
|
|
|
// Copyright (C) 2013 - 2024, The pgAdmin Development Team
|
2023-10-23 07:13:17 -05:00
|
|
|
// This software is released under the PostgreSQL Licence
|
|
|
|
//
|
|
|
|
//////////////////////////////////////////////////////////////
|
2021-01-16 05:36:50 -06:00
|
|
|
import { PortModel } from '@projectstorm/react-diagrams-core';
|
|
|
|
import OneToManyPortModel from 'pgadmin.tools.erd/erd_tool/ports/OneToManyPort';
|
|
|
|
import {OneToManyLinkModel} from 'pgadmin.tools.erd/erd_tool/links/OneToManyLink';
|
|
|
|
|
|
|
|
describe('ERD OneToManyPortModel', ()=>{
|
|
|
|
it('removeAllLinks', ()=>{
|
2023-10-23 07:13:17 -05:00
|
|
|
let link1 = {'remove': jest.fn()};
|
|
|
|
let link2 = {'remove': jest.fn()};
|
|
|
|
jest.spyOn(PortModel.prototype, 'getLinks').mockReturnValue([link1, link2]);
|
2021-01-16 05:36:50 -06:00
|
|
|
|
|
|
|
let portObj = new OneToManyPortModel({options: {}});
|
|
|
|
portObj.removeAllLinks();
|
|
|
|
expect(link1.remove).toHaveBeenCalled();
|
|
|
|
expect(link2.remove).toHaveBeenCalled();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('createLinkModel', ()=>{
|
|
|
|
let portObj = new OneToManyPortModel({options: {}});
|
2021-01-18 05:09:58 -06:00
|
|
|
expect(portObj.createLinkModel() instanceof OneToManyLinkModel).toBeTruthy();
|
2021-01-16 05:36:50 -06:00
|
|
|
});
|
|
|
|
});
|