pgadmin4/web/regression/javascript/erd/erd_model_spec.js
2023-01-02 11:53:55 +05:30

35 lines
842 B
JavaScript

/////////////////////////////////////////////////////////////
//
// pgAdmin 4 - PostgreSQL Tools
//
// Copyright (C) 2013 - 2023, The pgAdmin Development Team
// This software is released under the PostgreSQL Licence
//
//////////////////////////////////////////////////////////////
import ERDModel from 'pgadmin.tools.erd/erd_tool/ERDModel';
describe('ERDModel', ()=>{
it('getNodesDict', ()=>{
let model = new ERDModel();
spyOn(model, 'getNodes').and.returnValue([
{
name: 'test1',
getID: function() {
return 'id1';
},
},
{
name: 'test2',
getID: function() {
return 'id2';
},
},
]);
expect(JSON.stringify(model.getNodesDict())).toBe(JSON.stringify({
'id1': {name: 'test1'},
'id2': {name: 'test2'},
}));
});
});