Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/update av link for essentials #1487

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions packages/link/src/Link.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ import classNames from 'classnames';
import { isAbsoluteUrl } from '@availity/resolve-url';

// if absolute or loadApp is disabled, return url. otherwise loadappify the url
export const getUrl = (url = '', loadApp = false, absolute = false) => {
const isEssentials = /(test|qa(p?)-)?essentials\.availity\.com/.test(url);

if ((absolute || !loadApp) && !isEssentials) return url;
export const getUrl = (url = '', loadApp, absolute) => {
if (absolute || !loadApp) return url;

return `/public/apps/home/#!/loadApp?appUrl=${encodeURIComponent(url)}`;
};
Expand Down
21 changes: 0 additions & 21 deletions packages/link/tests/Link.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,25 +114,4 @@ describe('AvLink', () => {
expect(link).toHaveAttribute('class', 'link card-link');
expect(link).toHaveAttribute('style', 'font-weight: bold;');
});

test('should render urls from the test-essentials.availity.com domain correctly', () => {
const exampleHref = 'https://test-essentials.availity.com/static/avonly/post/cs/enhanced-claim-status-ui/';

const { getByTestId } = render(<AvLink href={exampleHref}>My App</AvLink>);

const tag = getByTestId('av-link-tag');
const expected = `/public/apps/home/#!/loadApp?appUrl=${encodeURIComponent(exampleHref)}`;

expect(tag.getAttribute('href')).toBe(expected);
});
test('should render urls from the qa-essentials.availity.com domain correctly', () => {
const exampleHref = 'https://qa-essentials.availity.com/static/avonly/post/cs/enhanced-claim-status-ui/';

const { getByTestId } = render(<AvLink href={exampleHref}>My App</AvLink>);

const tag = getByTestId('av-link-tag');
const expected = `/public/apps/home/#!/loadApp?appUrl=${encodeURIComponent(exampleHref)}`;

expect(tag.getAttribute('href')).toBe(expected);
});
});
Loading