Skip to content

Commit

Permalink
Make forms/collect directory in project layout
Browse files Browse the repository at this point in the history
Also add tests for initialise-project-layout action
  • Loading branch information
alxndrsn committed Oct 13, 2017
1 parent c317b31 commit fe3c475
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "medic-configurer-beta",
"version": "1.6.3",
"version": "1.6.4",
"description": "Configure Medic Mobile deployments",
"main": "index.js",
"scripts": {
Expand Down
1 change: 1 addition & 0 deletions src/fn/initialise-project-layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const LAYOUT = {
'tasks.json': {},
forms: {
app: {},
collect: {},
contact: {},
},
translations: {},
Expand Down
37 changes: 37 additions & 0 deletions test/fn/initialise-project-layout.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
const assert = require('chai').assert;
const fs = require('../../src/lib/sync-fs');

const TARGET_DIR = 'build/test/initialise-project-layout';

const initialiseProjectLayout = require('../../src/fn/initialise-project-layout');


describe('initialise-project-layout', () => {

it('should create a project with the desired layout', () => {

// when
initialiseProjectLayout(TARGET_DIR);

// then
assertExists('app_settings.json');
assertExists('contact-summary.js');
assertExists('forms/app');
assertExists('forms/collect');
assertExists('forms/contact');
assertExists('resources');
assertExists('resources.json');
assertExists('rules.nools.js');
assertExists('targets.json');
assertExists('tasks.json');
assertExists('translations');

});

});


function assertExists(relativePath) {
const path = `${TARGET_DIR}/${relativePath}`;
assert.isTrue(fs.exists(path), `Expected file/dir not found: ${path}`);
}

0 comments on commit fe3c475

Please sign in to comment.