jsdoc/test/specs/documentation/restparams.js
Jeff Williams aa0b6c1bfa switch to new-ish ECMAScript syntax
With help from Lebab, plus a lot of manual cleanup. (And more cleanup to come, I'm sure.)
2019-01-15 18:39:10 -08:00

38 lines
1.4 KiB
JavaScript

describe('rest parameters', () => {
const docSet = jasmine.getDocSetFromFile('test/fixtures/restparams.js');
const setAdmins = docSet.getByLongname('setAdmins')[0];
const setManagers = docSet.getByLongname('setManagers')[0];
const setWidgetAccess = docSet.getByLongname('setWidgetAccess')[0];
it('should automatically mark standalone rest parameters as repeatable', () => {
const restParam = setAdmins.params[0];
expect(restParam.name).toBe('users');
expect(restParam.variable).toBe(true);
});
it('should automatically mark rest parameters as repeatable when they are mixed with other params', () => {
const restParam = setWidgetAccess.params[1];
expect(restParam.name).toBe('users');
expect(restParam.variable).toBe(true);
});
it('should automatically mark rest parameters as repeatable when the function is assigned to a variable', () => {
const restParam = setManagers.params[0];
expect(restParam.name).toBe('users');
expect(restParam.variable).toBe(true);
});
describe('ES2015 methods', () => {
const docSet2 = jasmine.getDocSetFromFile('test/fixtures/restparams2.js');
const addUsers = docSet2.getByLongname('Widget#addUsers')[0];
it('should autodetect rest parameters', () => {
expect(addUsers.params[0].variable).toBe(true);
});
});
});