From fd1a0069a518e5600788ffcb5a5b222e58be11b0 Mon Sep 17 00:00:00 2001 From: Romain Date: Thu, 18 Feb 2021 22:27:35 +0100 Subject: [PATCH] chore: move all testable code to --- .nycrc.yml | 1 - bin/thumbsup.js | 8 ++++---- {bin => src/cli}/dependencies.js | 0 {bin => src/cli}/messages.js | 0 {bin => src/cli}/options.js | 0 src/problems.js | 2 +- test/{bin => cli}/messages.spec.js | 2 +- test/{bin => cli}/options.spec.js | 2 +- test/integration/integration.spec.js | 2 +- 9 files changed, 8 insertions(+), 9 deletions(-) rename {bin => src/cli}/dependencies.js (100%) rename {bin => src/cli}/messages.js (100%) rename {bin => src/cli}/options.js (100%) rename test/{bin => cli}/messages.spec.js (95%) rename test/{bin => cli}/options.spec.js (99%) diff --git a/.nycrc.yml b/.nycrc.yml index 0868968..8034126 100644 --- a/.nycrc.yml +++ b/.nycrc.yml @@ -1,7 +1,6 @@ all: true include: - src/** - - bin/** reporter: - html - text-summary diff --git a/bin/thumbsup.js b/bin/thumbsup.js index 356bec2..ac1d747 100755 --- a/bin/thumbsup.js +++ b/bin/thumbsup.js @@ -3,9 +3,9 @@ const fs = require('fs-extra') const moment = require('moment') const Analytics = require('./analytics') -const dependencies = require('./dependencies') -const messages = require('./messages') -const options = require('./options') +const dependencies = require('../src/cli/dependencies') +const messages = require('../src/cli/messages') +const options = require('../src/cli/options') console.log('') @@ -85,7 +85,7 @@ function exit (code) { setTimeout(() => process.exit(code), 10) } -// Cound the total number of nested albums +// Count the total number of nested albums function countAlbums (total, album) { return 1 + album.albums.reduce(countAlbums, total) } diff --git a/bin/dependencies.js b/src/cli/dependencies.js similarity index 100% rename from bin/dependencies.js rename to src/cli/dependencies.js diff --git a/bin/messages.js b/src/cli/messages.js similarity index 100% rename from bin/messages.js rename to src/cli/messages.js diff --git a/bin/options.js b/src/cli/options.js similarity index 100% rename from bin/options.js rename to src/cli/options.js diff --git a/src/problems.js b/src/problems.js index 94cd1e6..0f4c3d5 100644 --- a/src/problems.js +++ b/src/problems.js @@ -1,5 +1,5 @@ const warn = require('debug')('thumbsup:warn') -const messages = require('../bin/messages') +const messages = require('./cli/messages') /* Keeps track of which source files we failed to process diff --git a/test/bin/messages.spec.js b/test/cli/messages.spec.js similarity index 95% rename from test/bin/messages.spec.js rename to test/cli/messages.spec.js index abab9ea..8eca7b1 100644 --- a/test/bin/messages.spec.js +++ b/test/cli/messages.spec.js @@ -1,5 +1,5 @@ const should = require('should/as-function') -const messages = require('../../bin/messages.js') +const messages = require('../../src/cli/messages.js') describe('messages', function () { it('shows SUCCESS in a box', () => { diff --git a/test/bin/options.spec.js b/test/cli/options.spec.js similarity index 99% rename from test/bin/options.spec.js rename to test/cli/options.spec.js index c21162b..6fec119 100644 --- a/test/bin/options.spec.js +++ b/test/cli/options.spec.js @@ -2,7 +2,7 @@ const path = require('path') const process = require('process') const should = require('should/as-function') const sinon = require('sinon') -const options = require('../../bin/options.js') +const options = require('../../src/cli/options.js') const BASE_ARGS = ['--input', 'photos', '--output', 'website'] diff --git a/test/integration/integration.spec.js b/test/integration/integration.spec.js index d0f8eb6..67ad573 100644 --- a/test/integration/integration.spec.js +++ b/test/integration/integration.spec.js @@ -3,7 +3,7 @@ const glob = require('glob') const path = require('path') const should = require('should/as-function') const fixtures = require('../fixtures') -const options = require('../../bin/options') +const options = require('../../src/cli/options') const index = require('../../src/index') describe('Full integration', function () {