From 02b06aba62a9288bd52d0e80fec08e61683f406e Mon Sep 17 00:00:00 2001 From: Jonas Lagoni Date: Mon, 9 Oct 2023 11:26:59 +0200 Subject: [PATCH] fix: channel parameter not always returning schema (#868) --- src/models/v3/channel-parameter.ts | 8 +------- test/models/v3/channel-parameter.spec.ts | 15 +++++++++++---- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/models/v3/channel-parameter.ts b/src/models/v3/channel-parameter.ts index 54099a351..41e46bfab 100644 --- a/src/models/v3/channel-parameter.ts +++ b/src/models/v3/channel-parameter.ts @@ -13,16 +13,10 @@ export class ChannelParameter extends BaseModel({}); const d = new ChannelParameter(doc); - expect(d.hasSchema()).toEqual(false); + expect(d.hasSchema()).toEqual(true); }); }); @@ -87,10 +87,17 @@ describe('ChannelParameter model', function() { expect(d.schema()?.default()).toEqual('test'); }); - it('should return undefined when there is no value', function() { + it('should be able to access description value', function() { + const doc = serializeInput({ description: 'test' }); + const d = new ChannelParameter(doc); + expect(d.schema()).toBeInstanceOf(Schema); + expect(d.schema()?.description()).toEqual('test'); + }); + it('should return empty schema with type string when there is no value', function() { const doc = serializeInput({}); const d = new ChannelParameter(doc); - expect(d.schema()).toBeUndefined(); + expect(d.schema()).toBeInstanceOf(Schema); + expect(d.schema()?.type()).toEqual('string'); }); });