Skip to content

Commit 05c769c

Browse files
committed
test: spread assignments
1 parent 978ebd6 commit 05c769c

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

tests/fixtures/controllers/methodController.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,11 @@ export class MethodController extends Controller {
169169
@Extension('x-attKey7', { test: ['testVal', 123, true, null] })
170170
@Extension('x-attKey8', { test: { testArray: ['testVal1', true, null, ['testVal2', 'testVal3', 123, true, null]] } })
171171
@Extension(ATT_KEY9, 'identifierAttValue')
172+
@Extension('x-attKey10', ['testVal1', ...['testVal2', 123, true, null]])
173+
@Extension('x-attKey11', ['testVal1', ...'val'])
174+
@Extension('x-attKey12', { ...[1, 2, 3, 4] })
175+
@Extension('x-attKey13', { ...['testVal1', 123, true, null] })
176+
@Extension('x-attKey14', { ...{ y0: 'yt0', y1: 'yt1', y2: 123, y3: true, y4: null } })
172177
@Get('Extension')
173178
public async extension(): Promise<TestModel> {
174179
return new ModelService().getModel();

tests/unit/swagger/definitionsGeneration/metadata.spec.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,11 @@ describe('Metadata generation', () => {
321321
{ key: 'x-attKey7', value: { test: ['testVal', 123, true, null] } },
322322
{ key: 'x-attKey8', value: { test: { testArray: ['testVal1', true, null, ['testVal2', 'testVal3', 123, true, null]] } } },
323323
{ key: 'x-attKey9', value: 'identifierAttValue' },
324+
{ key: 'x-attKey10', value: ['testVal1', 'testVal2', 123, true, null] },
325+
{ key: 'x-attKey11', value: ['testVal1', 'v', 'a', 'l'] },
326+
{ key: 'x-attKey12', value: { '0': 1, '1': 2, '2': 3, '3': 4 } },
327+
{ key: 'x-attKey13', value: { '0': 'testVal1', '1': 123, '2': true, '3': null } },
328+
{ key: 'x-attKey14', value: { y0: 'yt0', y1: 'yt1', y2: 123, y3: true, y4: null } },
324329
];
325330

326331
expect(method.extensions).to.deep.equal(expectedExtensions);

tests/unit/swagger/schemaDetails.spec.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -701,6 +701,11 @@ describe('Schema details generation', () => {
701701
expect(extensionPath).to.have.property('x-attKey6');
702702
expect(extensionPath).to.have.property('x-attKey7');
703703
expect(extensionPath).to.have.property('x-attKey8');
704+
expect(extensionPath).to.have.property('x-attKey10');
705+
expect(extensionPath).to.have.property('x-attKey11');
706+
expect(extensionPath).to.have.property('x-attKey12');
707+
expect(extensionPath).to.have.property('x-attKey13');
708+
expect(extensionPath).to.have.property('x-attKey14');
704709

705710
// Verify that extensions have correct values
706711
expect(extensionPath['x-attKey']).to.deep.equal('attValue');
@@ -712,6 +717,11 @@ describe('Schema details generation', () => {
712717
expect(extensionPath['x-attKey6']).to.deep.equal([{ y0: 'yt0', y1: 'yt1', y2: 123, y3: true, y4: null }, { y2: 'yt2' }]);
713718
expect(extensionPath['x-attKey7']).to.deep.equal({ test: ['testVal', 123, true, null] });
714719
expect(extensionPath['x-attKey8']).to.deep.equal({ test: { testArray: ['testVal1', true, null, ['testVal2', 'testVal3', 123, true, null]] } });
720+
expect(extensionPath['x-attKey10']).to.deep.equal(['testVal1', 'testVal2', 123, true, null]);
721+
expect(extensionPath['x-attKey11']).to.deep.equal(['testVal1', 'v', 'a', 'l']);
722+
expect(extensionPath['x-attKey12']).to.deep.equal({ '0': 1, '1': 2, '2': 3, '3': 4 });
723+
expect(extensionPath['x-attKey13']).to.deep.equal({ '0': 'testVal1', '1': 123, '2': true, '3': null });
724+
expect(extensionPath['x-attKey14']).to.deep.equal({ y0: 'yt0', y1: 'yt1', y2: 123, y3: true, y4: null });
715725
});
716726

717727
describe('@Res responses', () => {

0 commit comments

Comments
 (0)