Skip to content

Commit

Permalink
Add unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenharris committed Apr 9, 2014
1 parent 628178d commit bc0f7ae
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 3 deletions.
17 changes: 14 additions & 3 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,21 @@ module.exports = function(grunt) {
},
},
without_screenshot_section: {
files: {
'tmp/readme-without-screenshots.md': 'test/fixtures/readme-without-screenshots.txt',
}
files: {
'tmp/readme-without-screenshots.md': 'test/fixtures/readme-without-screenshots.txt',
}
},
with_spaces_after_headers: {
files: {
'tmp/readme-with-spaces-after-headers.md': 'test/fixtures/readme-with-spaces-after-headers.txt',
}
},
with_spaces_between_plugin_details: {
files: {
'tmp/readme-with-spaces-between-plugin-details.md': 'test/fixtures/readme-with-spaces-between-plugin-details.txt',
}
},

},

// Unit tests.
Expand Down
13 changes: 13 additions & 0 deletions test/expected/readme-with-spaces-after-headers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Plugin Name #
**Contributors:** (this should be a list of wordpress.org userid's)
**Donate link:** http://example.com/
**Tags:** comments, spam
**Requires at least:** 3.0.1
**Tested up to:** 3.4
**Stable tag:** 4.3
**License:** GPLv2 or later
**License URI:** http://www.gnu.org/licenses/gpl-2.0.html

Here is a short description of the plugin. This should be no more than 150 characters. No markup here.

## Description ##
16 changes: 16 additions & 0 deletions test/expected/readme-with-spaces-between-plugin-details.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Plugin Name #
**Contributors:** (this should be a list of wordpress.org userid's)

**Donate link:** http://example.com/

**Tags:** comments, spam

**Requires at least:** 3.0.1

**Tested up to:** 3.4

**Stable tag:** 4.3

**License:** GPLv2 or later

**License URI:** http://www.gnu.org/licenses/gpl-2.0.html
13 changes: 13 additions & 0 deletions test/fixtures/readme-with-spaces-after-headers.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
=== Plugin Name ===
Contributors: (this should be a list of wordpress.org userid's)
Donate link: http://example.com/
Tags: comments, spam
Requires at least: 3.0.1
Tested up to: 3.4
Stable tag: 4.3
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Here is a short description of the plugin. This should be no more than 150 characters. No markup here.

== Description ==
16 changes: 16 additions & 0 deletions test/fixtures/readme-with-spaces-between-plugin-details.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
=== Plugin Name ===
Contributors: (this should be a list of wordpress.org userid's)

Donate link: http://example.com/

Tags: comments, spam

Requires at least: 3.0.1

Tested up to: 3.4

Stable tag: 4.3

License: GPLv2 or later

License URI: http://www.gnu.org/licenses/gpl-2.0.html
20 changes: 20 additions & 0 deletions test/wp_readme_to_markdown_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,24 @@ exports.wp_readme_to_markdown = {
test.done();
},

with_spaces_after_headers: function( test ){
test.expect(1);

var actual = grunt.file.read('tmp/readme-with-spaces-after-headers.md');
var expected = grunt.file.read('test/expected/readme-with-spaces-after-headers.md');
test.equal(actual, expected );

test.done();
},

with_spaces_between_plugin_details: function( test ){
test.expect(1);

var actual = grunt.file.read('tmp/readme-with-spaces-between-plugin-details.md');
var expected = grunt.file.read('test/expected/readme-with-spaces-between-plugin-details.md');
test.equal(actual, expected );

test.done();
},

};

0 comments on commit bc0f7ae

Please sign in to comment.