diff --git a/src/operations/profiles/types.ts b/src/operations/profiles/types.ts index 59710cf1e..ed780d3e5 100644 --- a/src/operations/profiles/types.ts +++ b/src/operations/profiles/types.ts @@ -3,7 +3,6 @@ import { AmazonMarketplaceAdvertisingCurrencyType, AmazonMarketplaceAdvertisingTimeZoneType, AmazonMarketplaceAdvertisingCountryCodeType, - createEnumType, } from '../commons/types' export const ProfileId = t.number @@ -33,12 +32,7 @@ export type ProfileResponse = t.TypeOf /** * The type of account being called */ -export enum AccountInfoTypeEnum { - SELLER = 'seller', - VENDOR = 'vendor', -} - -export const AccountInfoType = createEnumType(AccountInfoTypeEnum) +export const AccountInfoType = t.union([t.literal('seller'), t.literal('vendor')]) export type AccountInfoType = t.TypeOf export const AccountInfo = t.intersection([ @@ -135,19 +129,15 @@ export const ProfileRegistrationResponse = t.strict({ export type ProfileRegistrationResponse = t.TypeOf -export enum RegisterProfileResponseStatusEnum { - IN_PROGRESS = 'IN_PROGRESS', - SUCCESS = 'SUCCESS', -} - -export const RegisterProfileResponseStatusType = createEnumType( - RegisterProfileResponseStatusEnum, -) -export type RegisterProfileResponseStatusType = t.TypeOf +export const RegisterProfileResponseStatus = t.union([ + t.literal('IN_PROGRESS'), + t.literal('SUCCESS'), +]) +export type RegisterProfileResponseStatus = t.TypeOf export const RegisterProfileResponse = t.intersection([ t.type({ - status: RegisterProfileResponseStatusType, + status: RegisterProfileResponseStatus, statusDetails: t.string, }), t.partial({ diff --git a/test/index.test.ts b/test/index.test.ts index 338f4cc19..6415b780b 100644 --- a/test/index.test.ts +++ b/test/index.test.ts @@ -126,10 +126,8 @@ describe('index', () => { describe('profile', () => { it('should export all enums', () => { - expect(index.AccountInfoTypeEnum).toEqual(profileEnum.AccountInfoTypeEnum) - expect(index.RegisterProfileResponseStatusEnum).toEqual( - profileEnum.RegisterProfileResponseStatusEnum, - ) + expect(index.AccountInfoType).toEqual(profileEnum.AccountInfoType) + expect(index.RegisterProfileResponseStatus).toEqual(profileEnum.RegisterProfileResponseStatus) }) }) diff --git a/test/operations/profiles/profile-operation.test.ts b/test/operations/profiles/profile-operation.test.ts index a4eda2df6..ff30ec9da 100644 --- a/test/operations/profiles/profile-operation.test.ts +++ b/test/operations/profiles/profile-operation.test.ts @@ -1,7 +1,7 @@ import { OperationProvider } from '../../../src/operations/operation-provider' import { ProfileOperation } from '../../../src/operations/profiles/profile-operation' import { httpClientFactory } from '../../http-client-factory' -import { Profile, RegisterProfileResponseStatusEnum } from '../../../src/operations/profiles/types' +import { Profile } from '../../../src/operations/profiles/types' import { AmazonMarketplaceAdvertisingCountryCode } from '@scaleleap/amazon-marketplaces' import { delay } from '../../test-utils' @@ -77,7 +77,7 @@ describe('ProfileOperation', () => { const res = await profileOperation.registerBrand(param) expect(res).toBeTruthy() - expect(res.code).toBe(RegisterProfileResponseStatusEnum.SUCCESS) + expect(res.code).toBe('SUCCESS') }) })