Skip to content

Commit

Permalink
refactor: filter heartbeat check from private location check [sc-16788]
Browse files Browse the repository at this point in the history
  • Loading branch information
shiini2 committed Aug 2, 2023
1 parent c51ed89 commit b180c27
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions packages/cli/e2e/__tests__/deploy.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import axios from 'axios'
import { runChecklyCli } from '../run-checkly'
import Projects from '../../src/rest/projects'
import { DateTime, Duration } from 'luxon'
import CheckTypes from '../../src/constants'

async function cleanupProjects (projectLogicalId?: string) {
const baseURL: string = config.get('baseURL')
Expand Down Expand Up @@ -100,9 +101,11 @@ describe('deploy', () => {
const checkGroups = await getAllResources('check-groups')
const privateLocations = await getAllResources('private-locations')

// check that all assignments were applied
expect(checks.filter(({ privateLocations }: { privateLocations: string[] }) =>
privateLocations.some(slugName => slugName.startsWith(privateLocationSlugname))).length).toEqual(1)
// Check that all assignments were applied
// Filter out heartbeat checks as they don't have the privateLocations property
expect(checks.filter(({ checkType }: { checkType: string }) => checkType !== CheckTypes.HEARTBEAT)
.filter(({ privateLocations }: { privateLocations: string[] }) =>
privateLocations.some(slugName => slugName.startsWith(privateLocationSlugname))).length).toEqual(1)
expect(checkGroups.filter(({ privateLocations }: { privateLocations: string[] }) =>
privateLocations.some(slugName => slugName.startsWith(privateLocationSlugname))).length).toEqual(1)
expect(privateLocations
Expand All @@ -125,9 +128,11 @@ describe('deploy', () => {
const checkGroups = await getAllResources('check-groups')
const privateLocations = await getAllResources('private-locations')

// check that all assignments were applied
expect(checks.filter(({ privateLocations }: { privateLocations: string[] }) =>
privateLocations.some(slugName => slugName.startsWith(privateLocationSlugname))).length).toEqual(1)
// Check that all assignments were applied
// Filter out heartbeat checks as they don't have the privateLocations property
expect(checks.filter(({ checkType }: { checkType: string }) => checkType !== CheckTypes.HEARTBEAT)
.filter(({ privateLocations }: { privateLocations: string[] }) =>
privateLocations.some(slugName => slugName.startsWith(privateLocationSlugname))).length).toEqual(1)
expect(checkGroups.filter(({ privateLocations }: { privateLocations: string[] }) =>
privateLocations.some(slugName => slugName.startsWith(privateLocationSlugname))).length).toEqual(1)
expect(privateLocations
Expand Down

0 comments on commit b180c27

Please sign in to comment.