Skip to content
This repository has been archived by the owner on Mar 11, 2019. It is now read-only.

Commit

Permalink
Removed meta-suite.js
Browse files Browse the repository at this point in the history
Fixes #5
  • Loading branch information
JohanLorenzo committed May 22, 2015
1 parent bbead15 commit 52dc7fd
Show file tree
Hide file tree
Showing 9 changed files with 98 additions and 195 deletions.
8 changes: 0 additions & 8 deletions lib/model/meta-suite.js

This file was deleted.

9 changes: 4 additions & 5 deletions lib/parsers/markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@

var marked = require('marked');
var helper = require('./helper');
var parseMetaSuite = require('./meta-suite');
var parseSuite = require('./suite');

module.exports = function(text){
var lexer = new marked.Lexer();
var tokens = lexer.lex(text);

var metaSuiteTokens = helper.sortTokensByHierarchy(tokens, 'heading', 1);
var metaSuites = metaSuiteTokens.map(parseMetaSuite);
var suiteTokens = helper.sortTokensByHierarchy(tokens, 'heading', 1);
var suites = suiteTokens.map(parseSuite);

// FIXME This hack
return metaSuites[0];
return suites;
};
11 changes: 0 additions & 11 deletions lib/parsers/meta-suite.js

This file was deleted.

2 changes: 1 addition & 1 deletion lib/parsers/suite.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var helper = require('./helper');
var Suite = require('../model/suite');

module.exports = function(suiteToken) {
var testcasesTokens = helper.sortTokensByHierarchy(suiteToken.childrenTokens, 'heading', 3);
var testcasesTokens = helper.sortTokensByHierarchy(suiteToken.childrenTokens, 'heading', 2);
var testcases = testcasesTokens.map(parseTestcase);
return new Suite(suiteToken.name, testcases);
};
14 changes: 6 additions & 8 deletions test/e2e/default.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
# Functional
# Launch suite

## Launch suite

### fxos.func.sanity.launch_contacts
## fxos.func.sanity.launch_contacts
`bug 2 `
`story 1`
`draft`

Launch contacts! this is an updated version

### fxos.func.sanity.launch_music
## fxos.func.sanity.launch_music
`bug 3 `
`story 3`
`disabled`

Launch music


### fxos.func.sanity.launch_sms_repeated
## fxos.func.sanity.launch_sms_repeated
`bug 3 `
`story 3`
`xfail`
Expand All @@ -27,7 +25,7 @@ Do it again.
And again.


### fxos.func.parameterized.test
## fxos.func.parameterized.test
Launch the dialog, insert :val1, :val2, :val3 and hit enter.

ID | val1 | val2 | val3 |
Expand All @@ -36,7 +34,7 @@ id1 | a | 1 | one one
id2 | b | 2 | two two


### fxos.func.sanity.launch_rocketbar
## fxos.func.sanity.launch_rocketbar
`bug 4`
`story 3`
`draft`
Expand Down
83 changes: 40 additions & 43 deletions test/e2e/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,52 +7,49 @@ describe('cli', function() {
var exec = require('child_process').exec;
exec("./cli.js test/e2e/default.md", function(error, stdout) {

var expectedResult = JSON.stringify({
name: 'Functional',
suites: [{
name: 'Launch suite',
testcases: [{
id: 'fxos.func.sanity.launch_contacts',
instructions: 'Launch contacts! this is an updated version',
state: 'draft',
bug: 2,
userStory: 1
var expectedResult = JSON.stringify([{
name: 'Launch suite',
testcases: [{
id: 'fxos.func.sanity.launch_contacts',
instructions: 'Launch contacts! this is an updated version',
state: 'draft',
bug: 2,
userStory: 1
}, {
id: 'fxos.func.sanity.launch_music',
instructions: 'Launch music',
state: 'disabled',
bug: 3,
userStory: 3
}, {
id: 'fxos.func.sanity.launch_sms_repeated',
instructions: 'Launch SMS and measure elapsed time\nDo it again.\nAnd again.',
state: 'xfail',
bug: 3,
userStory: 3
}, {
id: 'fxos.func.parameterized.test',
instructions: 'Launch the dialog, insert :val1, :val2, :val3 and hit enter.',
state: 'active',
variables: [{
ID: 'id1',
val1: 'a',
val2: '1',
val3: 'one one'
}, {
id: 'fxos.func.sanity.launch_music',
instructions: 'Launch music',
state: 'disabled',
bug: 3,
userStory: 3
}, {
id: 'fxos.func.sanity.launch_sms_repeated',
instructions: 'Launch SMS and measure elapsed time\nDo it again.\nAnd again.',
state: 'xfail',
bug: 3,
userStory: 3
}, {
id: 'fxos.func.parameterized.test',
instructions: 'Launch the dialog, insert :val1, :val2, :val3 and hit enter.',
state: 'active',
variables: [{
ID: 'id1',
val1: 'a',
val2: '1',
val3: 'one one'
}, {
ID: 'id2',
val1: 'b',
val2: '2',
val3: 'two two'
}]
}, {
id: 'fxos.func.sanity.launch_rocketbar',
instructions: 'Launch rocketbar',
state: 'draft',
bug: 4,
userStory: 3
ID: 'id2',
val1: 'b',
val2: '2',
val3: 'two two'
}]
}, {
id: 'fxos.func.sanity.launch_rocketbar',
instructions: 'Launch rocketbar',
state: 'draft',
bug: 4,
userStory: 3
}]
});
}]);
expectedResult += '\n';
assert.deepEqual(stdout, expectedResult);

Expand Down
97 changes: 46 additions & 51 deletions test/unit/parsers/markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,24 @@ var parseMarkdown = require('../../../lib/parsers/markdown');
describe('The magical ugly parser', function() {

it('should transform the whole markdown file into this whole json file', function() {
var actualResult = parseMarkdown(['# Functional',
var actualResult = parseMarkdown(['# Launch suite',
'',
'## Launch suite',
'',
'### fxos.func.sanity.launch_contacts',
'## fxos.func.sanity.launch_contacts',
'`bug 2 `',
'`story 1`',
'`draft`',
'',
'Launch contacts! this is an updated version',
'',
'### fxos.func.sanity.launch_music',
'## fxos.func.sanity.launch_music',
'`bug 3 `',
'`story 3`',
'`disabled`',
'',
'Launch music',
'',
'',
'### fxos.func.sanity.launch_sms_repeated',
'## fxos.func.sanity.launch_sms_repeated',
'`bug 3 `',
'`story 3`',
'`xfail`',
Expand All @@ -35,7 +33,7 @@ describe('The magical ugly parser', function() {
'And again.',
'',
'',
'### fxos.func.parameterized.test',
'## fxos.func.parameterized.test',
'Launch the dialog, insert :val1, :val2, :val3 and hit enter.',
'',
'ID | val1 | val2 | val3 |',
Expand All @@ -44,60 +42,57 @@ describe('The magical ugly parser', function() {
'id2 | b | 2 | two two',
'',
'',
'### fxos.func.sanity.launch_rocketbar',
'## fxos.func.sanity.launch_rocketbar',
'`bug 4`',
'`story 3`',
'`draft`',
'',
'Launch rocketbar'
].join('\n'));

assert.deepEqual(actualResult, {
name: 'Functional',
suites: [{
name: 'Launch suite',
testcases: [{
"id": "fxos.func.sanity.launch_contacts",
"bug": 2,
"userStory": 1,
"state": "draft",
"instructions": "Launch contacts! this is an updated version"
}, {
"id": "fxos.func.sanity.launch_music",
"bug": 3,
"userStory": 3,
"state": "disabled",
"instructions": "Launch music"
}, {
"id": "fxos.func.sanity.launch_sms_repeated",
"bug": 3,
"userStory": 3,
"state": "xfail",
"instructions": "Launch SMS and measure elapsed time\nDo it again.\nAnd again."
}, {
"id": "fxos.func.parameterized.test",
"instructions": "Launch the dialog, insert :val1, :val2, :val3 and hit enter.",
"state": "active",
"variables": [{
"ID": "id1",
"val1": "a",
"val2": "1",
"val3": "one one"
}, {
"ID": "id2",
"val1": "b",
"val2": "2",
"val3": "two two"
}]
assert.deepEqual(actualResult, [{
name: 'Launch suite',
testcases: [{
"id": "fxos.func.sanity.launch_contacts",
"bug": 2,
"userStory": 1,
"state": "draft",
"instructions": "Launch contacts! this is an updated version"
}, {
"id": "fxos.func.sanity.launch_music",
"bug": 3,
"userStory": 3,
"state": "disabled",
"instructions": "Launch music"
}, {
"id": "fxos.func.sanity.launch_sms_repeated",
"bug": 3,
"userStory": 3,
"state": "xfail",
"instructions": "Launch SMS and measure elapsed time\nDo it again.\nAnd again."
}, {
"id": "fxos.func.parameterized.test",
"instructions": "Launch the dialog, insert :val1, :val2, :val3 and hit enter.",
"state": "active",
"variables": [{
"ID": "id1",
"val1": "a",
"val2": "1",
"val3": "one one"
}, {
"id": "fxos.func.sanity.launch_rocketbar",
"bug": 4,
"userStory": 3,
"state": "draft",
"instructions": "Launch rocketbar"
"ID": "id2",
"val1": "b",
"val2": "2",
"val3": "two two"
}]
}, {
"id": "fxos.func.sanity.launch_rocketbar",
"bug": 4,
"userStory": 3,
"state": "draft",
"instructions": "Launch rocketbar"
}]
});
}]);
});

});
67 changes: 0 additions & 67 deletions test/unit/parsers/meta-suite.js

This file was deleted.

Loading

0 comments on commit 52dc7fd

Please sign in to comment.