diff --git a/src/operations/ad-groups/types.test.ts b/src/operations/ad-groups/types.test.ts index 2056794e9..79bb96d72 100644 --- a/src/operations/ad-groups/types.test.ts +++ b/src/operations/ad-groups/types.test.ts @@ -42,3 +42,37 @@ describe('AdGroupResponse', () => { expect(isRight(res)).toBeTruthy() }) }) + +describe('AdGroupExtendedEdgeCase1', () => { + it('should pass getAdGroupEx response when servingStatus is "ENDED"', () => { + const res = t.AdGroupExtended.decode({ + adGroupId: 138818764235694, + name: 'New Name', + campaignId: 31299234922913, + defaultBid: 1, + state: 'archived', + servingStatus: 'ENDED', + creationDate: 1550902562000, + lastUpdatedDate: 1550904242000, + }) + + expect(isRight(res)).toBeTruthy() + }) +}) + +describe('AdGroupExtendedEdgeCase2', () => { + it('should pass getAdGroupEx response when servingStatus is "AD_GROUP_INCOMPLETE"', () => { + const res = t.AdGroupExtended.decode({ + adGroupId: 138818764235694, + name: 'New Name', + campaignId: 31299234922913, + defaultBid: 1, + state: 'archived', + servingStatus: 'AD_GROUP_INCOMPLETE', + creationDate: 1550902562000, + lastUpdatedDate: 1550904242000, + }) + + expect(isRight(res)).toBeTruthy() + }) +}) diff --git a/src/operations/ad-groups/types.ts b/src/operations/ad-groups/types.ts index 4751f4029..d7c31d5b3 100644 --- a/src/operations/ad-groups/types.ts +++ b/src/operations/ad-groups/types.ts @@ -37,6 +37,7 @@ export type AdGroupResponseStatus = t.TypeOf */ export const AdGroupServingStatus = t.union([ t.literal('AD_GROUP_ARCHIVED'), + t.literal('AD_GROUP_INCOMPLETE'), // The docs don't mention about this type t.literal('AD_GROUP_PAUSED'), t.literal('AD_GROUP_STATUS_ENABLED'), t.literal('AD_POLICING_SUSPENDED'), @@ -48,6 +49,7 @@ export const AdGroupServingStatus = t.union([ t.literal('ADVERTISER_PAYMENT_FAILURE'), t.literal('PORTFOLIO_PENDING_START_DATE'), // The docs don't mention about this type t.literal('PORTFOLIO_ENDED'), // The docs don't mention about this type + t.literal('ENDED'), // The docs don't mention about this type ]) export type AdGroupServingStatus = t.TypeOf diff --git a/src/operations/campaigns/types.test.ts b/src/operations/campaigns/types.test.ts index ec0dc8430..15c05b2d6 100644 --- a/src/operations/campaigns/types.test.ts +++ b/src/operations/campaigns/types.test.ts @@ -138,11 +138,29 @@ describe('Campaign Edge Case', () => { dailyBudget: 1, startDate: '20161024', state: 'archived', - bidding: { adjustments: [] } - }); - expect(isRight(edgecaseFragment)).toBeTruthy(); - }); -}); + bidding: { adjustments: [] }, + }) + expect(isRight(edgecaseFragment)).toBeTruthy() + }) +}) + +describe('Campaign Extended Edge Case', () => { + it('should pass getCampaignEx when servingStatus is "ENDED"', () => { + const edgecaseFragment = t.CampaignExtended.decode({ + campaignId: 108971111858080, + name: 'test', + campaignType: 'sponsoredProducts', + targetingType: 'auto', + premiumBidAdjustment: false, + dailyBudget: 1, + startDate: '20161024', + state: 'archived', + servingStatus: 'ENDED', + bidding: { adjustments: [] }, + }) + expect(isRight(edgecaseFragment)).toBeTruthy() + }) +}) /** * TODO: Update test script: diff --git a/src/operations/campaigns/types.ts b/src/operations/campaigns/types.ts index 354ddd5e3..ab7af4d03 100644 --- a/src/operations/campaigns/types.ts +++ b/src/operations/campaigns/types.ts @@ -45,11 +45,11 @@ export type CampaignState = t.TypeOf export const CampaignBidding = t.intersection([ t.type({ - adjustments: CampaignBiddingAdjustments + adjustments: CampaignBiddingAdjustments, }), t.partial({ - strategy: CampaignBiddingStrategy - }) + strategy: CampaignBiddingStrategy, + }), ]) export type CampaignBidding = t.TypeOf @@ -287,6 +287,7 @@ export const CampaignServingStatus = t.union([ t.literal('PORTFOLIO_ENDED'), // The docs don't say about this type t.literal('CAMPAIGN_INCOMPLETE'), // The docs don't say about this type t.literal('PENDING_START_DATE'), // The docs don't say about this type + t.literal('ENDED'), // The docs don't say about this type ]) export type CampaignServingStatus = t.TypeOf