Skip to content

Commit

Permalink
update unit test api endpoint mock urls
Browse files Browse the repository at this point in the history
  • Loading branch information
bnussman committed Feb 6, 2024
1 parent e9b5c2a commit b2044ff
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 12 deletions.
15 changes: 8 additions & 7 deletions packages/manager/src/factories/aclb.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import {
import * as Factory from 'factory.ts';

import { pickRandom } from 'src/utilities/random';

import type {
Certificate,
Configuration,
ConfigurationsEndpointHealth,
Expand All @@ -14,10 +18,7 @@ import {
ServiceTargetPayload,
ServiceTargetsEndpointHealth,
UpdateLoadbalancerPayload,
} from '@linode/api-v4/lib/aglb/types';
import * as Factory from 'factory.ts';

import { pickRandom } from 'src/utilities/random';
} from '@linode/api-v4';

export const mockCertificate = `
-----BEGIN CERTIFICATE-----
Expand Down Expand Up @@ -101,9 +102,9 @@ export const configurationFactory = Factory.Sync.makeFactory<Configuration>({
// ***********************
export const loadbalancerFactory = Factory.Sync.makeFactory<Loadbalancer>({
configurations: [{ id: 1, label: 'my-config-1' }],
hostname: 'loadbalancer1.aglb.akamai.com',
hostname: 'loadbalancer1.aclb.akamai.com',
id: Factory.each((i) => i),
label: Factory.each((i) => `aglb-${i}`),
label: Factory.each((i) => `aclb-${i}`),
regions: ['us-west'],
tags: ['tag1', 'tag2'],
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ describe('ConfigurationAccordionHeader', () => {

server.use(
rest.get(
'*/v4beta/aglb/5/configurations/endpoints-health',
'*/v4beta/aclb/5/configurations/endpoints-health',
(req, res, ctx) => res(ctx.json(allConfigurationsEndpointHealth))
)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('ConfigurationEndpointHealth', () => {
it('renders endpoint health from API data', async () => {
server.use(
rest.get(
'*/v4beta/aglb/:id/configurations/endpoints-health',
'*/v4beta/aclb/:id/configurations/endpoints-health',
(req, res, ctx) => {
const health = configurationsEndpointHealthFactory.build({
configurations: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { LoadBalancerEndpointHealth } from './LoadBalancerEndpointHealth';
describe('LoadBalancerEndpointHealth', () => {
it('renders endpoint health from API data', async () => {
server.use(
rest.get('*/v4beta/aglb/:id/endpoints-health', (req, res, ctx) => {
rest.get('*/v4beta/aclb/:id/endpoints-health', (req, res, ctx) => {
const health = loadbalancerEndpointHealthFactory.build({
healthy_endpoints: 150,
total_endpoints: 200,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('ServiceTargetEndpontHeath', () => {

server.use(
rest.get(
'*/v4beta/aglb/:id/service-targets/endpoints-health',
'*/v4beta/aclb/:id/service-targets/endpoints-health',
(req, res, ctx) => {
const health = serviceTargetsEndpointHealthFactory.build({
service_targets: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe('Ports', () => {
];

server.use(
rest.get('*/aglb/1/configurations*', (req, res, ctx) => {
rest.get('*/aclb/1/configurations*', (req, res, ctx) => {
return res(ctx.json(makeResourcePage(configs)));
})
);
Expand Down

0 comments on commit b2044ff

Please sign in to comment.