2021-08-10 06:51:09 -05:00
|
|
|
/////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// pgAdmin 4 - PostgreSQL Tools
|
|
|
|
//
|
2022-01-04 02:24:25 -06:00
|
|
|
// Copyright (C) 2013 - 2022, The pgAdmin Development Team
|
2021-08-10 06:51:09 -05:00
|
|
|
// This software is released under the PostgreSQL Licence
|
|
|
|
//
|
|
|
|
//////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
import '../helper/enzyme.helper';
|
|
|
|
import { createMount } from '@material-ui/core/test-utils';
|
2021-08-17 06:17:05 -05:00
|
|
|
import BaseUISchema from 'sources/SchemaView/base_schema.ui';
|
2021-08-10 06:51:09 -05:00
|
|
|
import PgaJobSchema from '../../../pgadmin/browser/server_groups/servers/pgagent/static/js/pga_job.ui';
|
2022-01-28 05:50:34 -06:00
|
|
|
import {genericBeforeEach, getCreateView, getEditView, getPropertiesView} from '../genericFunctions';
|
2021-08-10 06:51:09 -05:00
|
|
|
|
2021-08-17 06:17:05 -05:00
|
|
|
class MockSchema extends BaseUISchema {
|
|
|
|
get baseFields() {
|
|
|
|
return [];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-10 06:51:09 -05:00
|
|
|
describe('PgaJobSchema', ()=>{
|
|
|
|
let mount;
|
2021-08-17 06:17:05 -05:00
|
|
|
let schemaObj = new PgaJobSchema(
|
|
|
|
{
|
2022-01-12 06:02:20 -06:00
|
|
|
jobjclid:()=>[],
|
2021-08-17 06:17:05 -05:00
|
|
|
},
|
|
|
|
()=>new MockSchema(),
|
|
|
|
);
|
2021-08-10 06:51:09 -05:00
|
|
|
let getInitData = ()=>Promise.resolve({});
|
|
|
|
|
|
|
|
/* Use createMount so that material ui components gets the required context */
|
|
|
|
/* https://material-ui.com/guides/testing/#api */
|
|
|
|
beforeAll(()=>{
|
|
|
|
mount = createMount();
|
|
|
|
});
|
|
|
|
|
|
|
|
afterAll(() => {
|
|
|
|
mount.cleanUp();
|
|
|
|
});
|
|
|
|
|
|
|
|
beforeEach(()=>{
|
2022-01-28 05:50:34 -06:00
|
|
|
genericBeforeEach();
|
2021-08-10 06:51:09 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
it('create', ()=>{
|
2022-01-28 05:50:34 -06:00
|
|
|
mount(getCreateView(schemaObj));
|
2021-08-10 06:51:09 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
it('edit', ()=>{
|
2022-01-28 05:50:34 -06:00
|
|
|
mount(getEditView(schemaObj, getInitData));
|
2021-08-10 06:51:09 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
it('properties', ()=>{
|
2022-01-28 05:50:34 -06:00
|
|
|
mount(getPropertiesView(schemaObj, getInitData));
|
2021-08-10 06:51:09 -05:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|