Skip to content

Commit

Permalink
Merge branch '__rultor'
Browse files Browse the repository at this point in the history
  • Loading branch information
rultor committed Dec 19, 2024
2 parents 77124f2 + fe2d425 commit 1edc808
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
6 changes: 5 additions & 1 deletion src/commands/docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,14 @@
* SOFTWARE.
*/

const fs = require('fs');
const path = require('path');

/**
* Command to create docs from .EO sources.
* @param {Hash} opts - All options
*/
module.exports = function(opts) {
console.info('This command is not yet implemented, sorry');
const filePath = path.resolve('eodocs.html');
fs.writeFileSync(filePath, '');
};
19 changes: 13 additions & 6 deletions test/commands/test_docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,25 @@
*/

const assert = require('assert');
const fs = require('fs');
const path = require('path');
const {runSync} = require('../helpers');

/**
* It should print a "not yet implemented" message when run.
* It should create an empty 'eodocs.html' file in the current directory.
* @param {Function} done - Mocha's callback to signal completion
*/
describe('docs', function() {
it('generate documentation from XMIR files', function(done) {
const stdout = runSync(['docs']);
assert(
stdout.includes('This command is not yet implemented, sorry'),
`Expected "This command is not yet implemented, sorry" but got: ${stdout}`
it('creates an empty eodocs.html file', function(done) {
const filePath = path.resolve('eodocs.html');
fs.rmSync(filePath, {recursive: true, force: true});
runSync(['docs']);
assert(fs.existsSync(filePath), `Expected eodocs.html to be created, but it's missing`);
const content = fs.readFileSync(filePath, 'utf8');
assert.strictEqual(
content,
'',
`Expected eodocs.html to be empty, but it has content: ${content}`
);
done();
});
Expand Down

0 comments on commit 1edc808

Please sign in to comment.