Skip to content

Commit

Permalink
fix: Fix broken tests
Browse files Browse the repository at this point in the history
  • Loading branch information
zoemaas committed Nov 22, 2024
1 parent 2f4eb92 commit 74e1d46
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion packages/geolocation-store/__tests__/localAgent.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ let dbConnection: Promise<DataSource>
let agent: any

const setup = async (): Promise<boolean> => {
const config = await getConfig('packages/anomaly-detection-store/agent.yml')
const config = await getConfig('packages/geolocation-store/agent.yml')
const { localAgent, db } = await createObjects(config, { localAgent: '/agent', db: '/dbConnection' })
agent = localAgent
dbConnection = db
Expand Down
2 changes: 1 addition & 1 deletion packages/geolocation-store/__tests__/restAgent.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const getAgent = (options?: IAgentOptions) =>
})

const setup = async (): Promise<boolean> => {
const config = await getConfig('packages/anomaly-detection-store/agent.yml')
const config = await getConfig('packages/geolocation-store/agent.yml')
const { agent, db } = await createObjects(config, { agent: '/agent', db: '/dbConnection' })
serverAgent = agent
dbConnection = db
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,21 @@ export default (testContext: { getAgent: () => ConfiguredAgent; setup: () => Pro

it('should persist location', async () => {
await expect(
agent.anomalyDetectionStorePersistLocation({
agent.geolocationStorePersistLocation({
ipOrHostname: ip,
locationArgs: location
}),
).resolves.toEqual({ value: location })

await expect(agent.anomalyDetectionStoreHasLocation({
await expect(agent.geolocationStoreHasLocation({
ipOrHostname: ip,
storeId: '_default',
namespace: 'anomaly-detection'
})).resolves.toBeTruthy()
})

it('should have a location persisted', async () => {
await expect(agent.anomalyDetectionStoreGetLocation({
await expect(agent.geolocationStoreGetLocation({
ipOrHostname: ip,
storeId: '_default',
namespace: 'anomaly-detection'}
Expand All @@ -48,12 +48,12 @@ export default (testContext: { getAgent: () => ConfiguredAgent; setup: () => Pro
continent: 'NA',
country: 'US',
}
await agent.anomalyDetectionStorePersistLocation({
await agent.geolocationStorePersistLocation({
ipOrHostname: ipv6,
locationArgs: ipv6Location
})

await expect(agent.anomalyDetectionStoreGetLocation({
await expect(agent.geolocationStoreGetLocation({
storeId: '_default',
namespace: 'anomaly-detection',
ipOrHostname: ipv6
Expand All @@ -66,24 +66,24 @@ export default (testContext: { getAgent: () => ConfiguredAgent; setup: () => Pro
continent: 'EU',
country: 'DE',
}
await agent.anomalyDetectionStorePersistLocation({
await agent.geolocationStorePersistLocation({
ipOrHostname: hostname,
locationArgs: hostnameLocation
})

await expect(agent.anomalyDetectionStoreRemoveLocation({
await expect(agent.geolocationStoreRemoveLocation({
ipOrHostname: ip,
storeId: '_default',
namespace: 'anomaly-detection'
})).resolves.toBeTruthy()
})

it('should remove all locations', async () => {
await expect(agent.anomalyDetectionStoreClearAllLocations()).resolves.toBeTruthy()
await expect(agent.geolocationStoreClearAllLocations()).resolves.toBeTruthy()
})

it('should retrieve the default location store', async () => {
await expect(agent.anomalyDetectionStoreDefaultLocationStore()).resolves.toBeDefined()
await expect(agent.geolocationStoreDefaultLocationStore()).resolves.toBeDefined()
})
})
}

0 comments on commit 74e1d46

Please sign in to comment.