jsdoc/test/specs/documentation/restparams.js
Jeff Williams 617b3236bf Replace old, vendored Jasmine with current npm package.
JSDoc-specific test functions are now properties of a `jsdoc` global, not a `jasmine` global.

Also updates license files to reflect the fact that we no longer vendor anything.
2019-05-12 15:10:38 -07:00

38 lines
1.4 KiB
JavaScript

describe('rest parameters', () => {
const docSet = jsdoc.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 = jsdoc.getDocSetFromFile('test/fixtures/restparams2.js');
const addUsers = docSet2.getByLongname('Widget#addUsers')[0];
it('should autodetect rest parameters', () => {
expect(addUsers.params[0].variable).toBe(true);
});
});
});