Skip to content

Commit

Permalink
Fix analytics test
Browse files Browse the repository at this point in the history
  • Loading branch information
hawyar committed Jul 20, 2023
1 parent 6345343 commit 5c631aa
Showing 1 changed file with 7 additions and 20 deletions.
27 changes: 7 additions & 20 deletions infrastructure/cdk/test/analytics.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as cdk from 'aws-cdk-lib'
import * as assertions from 'aws-cdk-lib/assertions'
import { Config } from '../src/providers/config'
import { AnalyticsStack } from '../src/providers/analytics'
import { Schema, eventSchema, walletSchema, stakingActionSchema } from '@casimir/data'
import { Schema, eventSchema, actionSchema } from '@casimir/data'

test('Analytics stack created', () => {
const config = new Config()
Expand All @@ -27,28 +27,15 @@ test('Analytics stack created', () => {
expect(columnName).toEqual(name)
}

const walletTable = Object.keys(resource).filter(key => key.includes('WalletTable'))[0]
const walletColumns = resource[walletTable].Properties.TableInput.StorageDescriptor.Columns
const walletGlueSchema = new Schema(walletSchema).getGlueColumns()
const actionTable = Object.keys(resource).filter(key => key.includes('WalletTable'))[0]
const actionColumns = resource[actionTable].Properties.TableInput.StorageDescriptor.Columns
const actionGlueSchema = new Schema(actionSchema).getGlueColumns()


for (const column of walletColumns) {
for (const column of actionColumns) {
const { Name: name, Type: type } = column
const columnName = Object.keys(walletSchema.properties).filter(key => key === name)[0]
const columnType = walletGlueSchema.filter(key => key.name === name)[0].type.inputString

expect(columnType).toEqual(type)
expect(columnName).toEqual(name)
}

const stakingActionTable = Object.keys(resource).filter(key => key.includes('StakingActionTable'))[0]
const stakingActionColumns = resource[stakingActionTable].Properties.TableInput.StorageDescriptor.Columns
const stakingActionGlueSchema = new Schema(stakingActionSchema).getGlueColumns()

for (const column of stakingActionColumns) {
const { Name: name, Type: type } = column
const columnName = Object.keys(stakingActionSchema.properties).filter(key => key === name)[0]
const columnType = stakingActionGlueSchema.filter(key => key.name === name)[0].type.inputString
const columnName = Object.keys(actionSchema.properties).filter(key => key === name)[0]
const columnType = actionGlueSchema.filter(key => key.name === name)[0].type.inputString

expect(columnType).toEqual(type)
expect(columnName).toEqual(name)
Expand Down

0 comments on commit 5c631aa

Please sign in to comment.