mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fix SQL help for EPAS 10+, and refactor the URL generation code into a testable function. Fixes #4099
This commit is contained in:
56
web/regression/javascript/help/help_spec.js
Normal file
56
web/regression/javascript/help/help_spec.js
Normal file
@@ -0,0 +1,56 @@
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin 4 - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2013 - 2019, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
import { getHelpUrl } from '../../../pgadmin/help/static/js/help';
|
||||
|
||||
describe('Test help functions', function() {
|
||||
describe('when getHelpUrl is called', function(){
|
||||
|
||||
// PG 9.6 docs
|
||||
it('it should be able to return a correct URL for PG 9.6 docs with a trailing slash', function() {
|
||||
expect(getHelpUrl('https://www.postgresql.org/docs/$VERSION$/', 'index.html', 90600)).toEqual('https://www.postgresql.org/docs/9.6/index.html');
|
||||
});
|
||||
|
||||
// PG 10 docs
|
||||
it('it should be able to return a correct URL for PG 10 docs with a trailing slash', function() {
|
||||
expect(getHelpUrl('https://www.postgresql.org/docs/$VERSION$/', 'index.html', 100000)).toEqual('https://www.postgresql.org/docs/10/index.html');
|
||||
});
|
||||
|
||||
// PG 9.6 docs
|
||||
it('it should be able to return a correct URL for PG 9.6 docs without a trailing slash', function() {
|
||||
expect(getHelpUrl('https://www.postgresql.org/docs/$VERSION$', 'index.html', 90600)).toEqual('https://www.postgresql.org/docs/9.6/index.html');
|
||||
});
|
||||
|
||||
// PG 10 docs
|
||||
it('it should be able to return a correct URL for PG 10 docs without a trailing slash', function() {
|
||||
expect(getHelpUrl('https://www.postgresql.org/docs/$VERSION$', 'index.html', 100000)).toEqual('https://www.postgresql.org/docs/10/index.html');
|
||||
});
|
||||
|
||||
// EPAS 9.6 docs
|
||||
it('it should be able to return a correct URL for EPAS 9.6 docs with a trailing slash', function() {
|
||||
expect(getHelpUrl('https://www.enterprisedb.com/docs/en/$VERSION$/pg/', 'index.html', 90600)).toEqual('https://www.enterprisedb.com/docs/en/9.6/pg/index.html');
|
||||
});
|
||||
|
||||
// EPAS 10 docs
|
||||
it('it should be able to return a correct URL for EPAS 10 docs with a trailing slash', function() {
|
||||
expect(getHelpUrl('https://www.enterprisedb.com/docs/en/$VERSION$/pg/', 'index.html', 100000)).toEqual('https://www.enterprisedb.com/docs/en/10/pg/index.html');
|
||||
});
|
||||
|
||||
// EPAS 9.6 docs
|
||||
it('it should be able to return a correct URL for EPAS 9.6 docs without a trailing slash', function() {
|
||||
expect(getHelpUrl('https://www.enterprisedb.com/docs/en/$VERSION$/pg', 'index.html', 90600)).toEqual('https://www.enterprisedb.com/docs/en/9.6/pg/index.html');
|
||||
});
|
||||
|
||||
// EPAS 10 docs
|
||||
it('it should be able to return a correct URL for EPAS 10 docs without a trailing slash', function() {
|
||||
expect(getHelpUrl('https://www.enterprisedb.com/docs/en/$VERSION$/pg', 'index.html', 100000)).toEqual('https://www.enterprisedb.com/docs/en/10/pg/index.html');
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user