Skip to content

Commit

Permalink
add specs for public functions
Browse files Browse the repository at this point in the history
  • Loading branch information
kalinchernev committed Oct 20, 2020
1 parent 105f461 commit 2b7d6a8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
13 changes: 4 additions & 9 deletions lib/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
const { YAMLException } = require('js-yaml');
const getSpecificationObject = require('./helpers/getSpecificationObject');

const createSpecification = require('./helpers/createSpecification');
const parseApiFileContent = require('./helpers/parseApiFileContent');
const updateSpecificationObject = require('./helpers/updateSpecificationObject');
const finalizeSpecificationObject = require('./helpers/finalizeSpecificationObject');

/**
* Generates the specification.
* @param {object} options - Configuration options
Expand Down Expand Up @@ -40,7 +35,7 @@ module.exports = (options) => {
}
};

module.exports.createSpecification = createSpecification;
module.exports.parseApiFileContent = parseApiFileContent;
module.exports.updateSpecificationObject = updateSpecificationObject;
module.exports.finalizeSpecificationObject = finalizeSpecificationObject;
module.exports.createSpecification = require('./helpers/createSpecification');
module.exports.parseApiFileContent = require('./helpers/parseApiFileContent');
module.exports.updateSpecificationObject = require('./helpers/updateSpecificationObject');
module.exports.finalizeSpecificationObject = require('./helpers/finalizeSpecificationObject');
13 changes: 13 additions & 0 deletions test/lib.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,19 @@ const { YAMLException } = require('js-yaml');
const swaggerJsdoc = require('../lib');

describe('swagger-jsdoc library', () => {
describe('Public APIs', () => {
it('main module is a function', () => {
expect(typeof swaggerJsdoc).toBe('function');
});

it('should expose a few utilities', () => {
expect(typeof swaggerJsdoc.createSpecification).toBe('function');
expect(typeof swaggerJsdoc.parseApiFileContent).toBe('function');
expect(typeof swaggerJsdoc.updateSpecificationObject).toBe('function');
expect(typeof swaggerJsdoc.finalizeSpecificationObject).toBe('function');
});
});

describe('Error handling', () => {
beforeEach(() => {
jest.clearAllMocks();
Expand Down

0 comments on commit 2b7d6a8

Please sign in to comment.