Skip to content

Commit 96546fe

Browse files
authored
fix(api): add integration tests
BREAKING CHANGE: two method signatures and one property name have changed. **Objects & Properties** 1. readmeInspector.ReadmeScore - refactor:rename ReadmeScore ➡️ ReadmeAppraisal 2. module:readme-inspector/readme-score - refactor:rename 'ReadmeScore' module:readme-inspector/readme-appraisal 'ReadmeAppraisal', which is now a class. **Functions** 1. getReadmeInfo 1.1. Function name - refactor:rename ➡️ getInfo 1.2. Function signature - now expects a params object literal 2. getReadmeScore 2.1. Function name - refactor:rename ➡️ getAppraisal 2.2. Function signature remains the same as in 1.x.x. 3. check's signature now expects a params object literal, which it passes to getInfo. **API tests** Add API (integration) tests to verify appraisal initialization. 1. Create the lib/__apis__/ directory 2. Add Jest/Jasmine specs without mocks 3. Invoke real APIs for results **CI** 1. Create four ENV variables on Appveyor. 2. Customize greenkeeper commit messages **Documentation** - Use commonality branding colors for 'Request a Feature' and 'Report a Defect' badges - Move DEVELOPERS.md user the /docs/project/ directory - Add secure variables to for API testing - Iterate through filepaths with markdown files that require automated content generation GH-18,GH-21
1 parent ad96ea5 commit 96546fe

File tree

128 files changed

+46438
-428
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+46438
-428
lines changed

.github/CONTRIBUTING.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -598,8 +598,8 @@
598598
| [[email protected]](https://github.com/sindresorhus/got#readme) | Simplified HTTP requests | 8.3.0 | MIT | production |
599599
| [[email protected]](https://github.com/yeoman/insight#readme) | Understand how your tool is being used by anonymously reporting usage metrics to Google Analytics or Yandex.Metrica | 0.10.1 | BSD-2-Clause | production |
600600
| [[email protected]](https://lodash.com/) | The lodash method `_.camelCase` exported as a module. | 4.3.0 | MIT | production |
601-
| [lodash.isstring@4.0.1](https://lodash.com/) | The lodash method `_.isString` exported as a module. | 4.0.1 | MIT | production |
602-
| [lodash.[email protected]](https://lodash.com/) | The lodash method `_.transform` exported as a module. | 4.6.0 | MIT | production |
601+
| [lodash.mapkeys@4.6.0](https://lodash.com/) | The lodash method `_.mapKeys` exported as a module. | 4.6.0 | MIT | production |
602+
| [lodash.[email protected]](https://lodash.com/) | The lodash method `_.noop` exported as a module. | 3.0.1 | MIT | production |
603603
| [[email protected]](https://github.com/sindresorhus/meow#readme) | CLI app helper | 4.0.0 | MIT | production |
604604
<!-- AUTO-GENERATED-CONTENT:END -->
605605

@@ -611,7 +611,7 @@
611611
| **Dependency** | **Description** | **Version** | **License** | **Type** |
612612
| -------------- | --------------- | ----------- | ----------- | -------- |
613613
| [@semantic-release/[email protected]](https://github.com/semantic-release/changelog#readme) | Set of semantic-release plugins for creating or updating a changelog file | 2.0.1 | MIT | dev |
614-
| [@semantic-release/[email protected].1](https://github.com/semantic-release/git#readme) | Set of semantic-release plugins to publish to a git repository | 4.0.1 | MIT | dev |
614+
| [@semantic-release/[email protected].2](https://github.com/semantic-release/git#readme) | Set of semantic-release plugins to publish to a git repository | 4.0.2 | MIT | dev |
615615
| [@semantic-release/[email protected]](https://github.com/semantic-release/npm#readme) | Set of semantic-release plugins to publish to a npm registry | 3.2.4 | MIT | dev |
616616
| [[email protected]](https://github.com/epoberezkin/ajv) | Another JSON Schema Validator | 6.4.0 | MIT | dev |
617617
| [[email protected]](https://github.com/epoberezkin/ajv-keywords#readme) | Custom JSON-Schema keywords for Ajv validator | 3.1.0 | MIT | dev |
@@ -649,7 +649,7 @@
649649
| [[email protected]](https://github.com/camacho/markdown-magic-package-scripts#readme) | Print list of scripts in package.json with descriptions | 1.2.1 | MIT | dev |
650650
| [[email protected]](https://github.com/Nijikokun/minami) | Clean and minimal JSDoc 3 Template / Theme | 1.2.3 | UNLICENSED | dev |
651651
| [nsp@^3.2.1](https://github.com/nodesecurity/nsp#readme) | The Node Security (nodesecurity.io) command line interface | 3.2.1 | Apache-2.0 | dev |
652-
| [[email protected]](https://prettier.io) | Prettier is an opinionated code formatter | 1.12.0 | MIT | dev |
652+
| [[email protected]](https://prettier.io) | Prettier is an opinionated code formatter | 1.12.1 | MIT | dev |
653653
| [[email protected]](https://github.com/semantic-release/semantic-release#readme) | Automated semver compliant package publishing | 15.1.7 | MIT | dev |
654654
| [[email protected]](https://github.com/zeke/standard-markdown#readme) | Test your Markdown files for Standard JavaScript Style™ | 4.0.2 | MIT | dev |
655655
| [[email protected]](https://github.com/conventional-changelog/standard-version#readme) | replacement for `npm version` with automatic CHANGELOG generation | 4.3.0 | ISC | dev |

.github/assets/examples/usage.js

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
// Load all .env variables before anything else.
2+
3+
const dotenvExtended = require('dotenv-extended')
4+
const envConfig = dotenvExtended.config()
5+
6+
// Import readme-inspector.
7+
8+
const readmeInspector = require('readme-inspector')
9+
10+
// Recommended: authenticate to avoid rate limts.
11+
12+
readmeInspector.authenticate({
13+
token: envConfig.GH_TOKEN,
14+
type: 'oauth'
15+
})
16+
17+
// Verify that the repository with the slug
18+
// gregswindle/github-resource-converter
19+
// 1. Has a README, and
20+
// 2. Score the README for quality.
21+
22+
const info = await readmeInspector.check(
23+
'gregswindle',
24+
'github-resource-converter'
25+
)
26+
27+
// Display the resulting readmeInfo as a
28+
// JSON string.
29+
30+
const WHITESPACE = 2
31+
console.log(JSON.stringify(results, null, WHITESPACE))
32+
// =>
33+
/*
34+
{
35+
"appraisal": {
36+
"breakdown": {
37+
"cumulativeCodeBlockLength": 0,
38+
"hasLists": 0,
39+
"lowCodeBlockPenalty": 0,
40+
"numberOfCodeBlocks": 0,
41+
"numberOfGifs": 0,
42+
"numberOfImages": 0,
43+
"numberOfNonCodeSections": 0
44+
},
45+
"error": null,
46+
"score": 0,
47+
"url": null
48+
},
49+
"error": null,
50+
"isPresent": true,
51+
"value": {
52+
"name": "README.md",
53+
"path": "README.md",
54+
"sha": "4769744aad57ff3e9aac2df603795c4d10fcdc31",
55+
"size": 36877,
56+
"url": "https://api.github.com/repos/commonality/readme-inspector/contents/README.md?ref=master",
57+
"html_url": "https://github.com/commonality/readme-inspector/blob/master/README.md",
58+
"git_url": "https://api.github.com/repos/commonality/readme-inspector/git/blobs/4769744aad57ff3e9aac2df603795c4d10fcdc31",
59+
"download_url": "https://raw.githubusercontent.com/commonality/readme-inspector/master/README.md",
60+
"type": "file",
61+
"content": "{base64-encoding-of-readme-markdown}",
62+
"encoding": "base64",
63+
"_links": {
64+
"self": "https://api.github.com/repos/commonality/readme-inspector/contents/README.md?ref=master",
65+
"git": "https://api.github.com/repos/commonality/readme-inspector/git/blobs/4769744aad57ff3e9aac2df603795c4d10fcdc31",
66+
"html": "https://github.com/commonality/readme-inspector/blob/master/README.md"
67+
}
68+
}
69+
}
70+
*/

.github/config/.jsdoc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"showInheritedInNav": true
1717
},
1818
"opts": {
19-
"destination": "./docs/",
19+
"destination": "./docs/api/",
2020
"encoding": "utf8",
2121
"private": true,
2222
"recurse": true,

.github/config/markdown.config.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@ const config = {
1515

1616
const main = () => {
1717
let markdownPath = path.join(__dirname, '**/*.md')
18-
markdownMagic(markdownPath, config)
18+
let index = 0
19+
let paths = ['**/*.md', '../CONTRIBUTING.md', '../../docs/**/*.md']
1920

20-
markdownPath = path.join(__dirname, '..', 'CONTRIBUTING.md')
21-
console.log(markdownPath)
22-
markdownMagic(markdownPath, config)
21+
paths.forEach(filePath => {
22+
markdownPath = path.join(__dirname, filePath)
23+
markdownMagic(markdownPath, config)
24+
})
2325
}
2426

2527
main()

.github/config/sonar-project.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ sonar.sourceEncoding=UTF-8
3030
sonar.organization=commonality
3131
sonar.projectKey=readme-inspector
3232
sonar.projectName=readme-inspector
33-
sonar.projectVersion=1.0.2
33+
# sonar.projectVersion=1.0.2
3434

3535
# =====================================================
3636
# Meta-data for the project

.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ script:
3737
after_script:
3838
- npm run posttest:ci:coverage:codacy
3939
- npm run posttest:ci:coverage:coveralls
40-
- sonar-scanner -Dproject.settings=./.github/config/sonar-project.properties -Dsonar.organization=$SONAR_ORGANIZATION
41-
-Dsonar.login=$SONAR_COMMONALITY_TOKEN -X
40+
- npm run code-quality:sonar
4241
jobs:
4342
include:
4443
- stage: release

CHANGELOG.md

Lines changed: 59 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,47 @@
22

33
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
44

5+
---
6+
7+
<a name="2.0.0"></a>
8+
9+
## [2.0.0](https://github.com/commonality/readme-inspector/compare/v1.0.2...v2.0.0) (2018-04-21)
10+
11+
### Bug Fixes
12+
13+
* **@semantic-release/git:** update to version 4.0.2 ([ad96ea5](https://github.com/commonality/readme-inspector/commit/ad96ea5))
14+
* **score:** verify appraisal initialization ([fd87a8b](https://github.com/commonality/readme-inspector/commit/fd87a8b)), closes [#18](https://github.com/commonality/readme-inspector/issues/18) [#21](https://github.com/commonality/readme-inspector/issues/21)
15+
16+
### BREAKING CHANGES
17+
18+
**readme-score:** `ReadmeScore` is now `ReadmeAppraisal`, with two method signatures changes and one property name change.
19+
20+
#### Objects & Properties
21+
22+
`readmeInspector.ReadmeScore` - refactor:rename `ReadmeScore``ReadmeAppraisal`, which is now a class.
23+
24+
#### Functions
25+
26+
1. `readmeInspector.getReadmeInfo``readmeInspector.getInfo`
27+
28+
> * Refactor:rename function
29+
>
30+
> * Refactor function signature: now expects a `params` object literal
31+
32+
2. `readmeInspector.getReadmeScore``readmeInspector.getAppraisal`
33+
34+
> Refactor:rename function; signature remains the same as in 1.x.x,
35+
> however.
36+
37+
3. `readmeInspector.check`'s signature now expects a `params` object literal,
38+
which it passes to `getInfo`.
39+
40+
#### API tests
41+
42+
Add API (integration) tests.
43+
44+
---
45+
546
<a name="1.0.2"></a>
647

748
## [1.0.2](https://github.com/commonality/readme-inspector/compare/v1.0.1...v1.0.2) (2018-04-17)
@@ -14,6 +55,8 @@ All notable changes to this project will be documented in this file. See [standa
1455
>
1556
> Refactor `readmeScoreApiClientOptions` with a single property called `apiEndpoint: URL` in order to set the `url` query parameter explicitly, and call `apiEndpoint.toString()` for a serialized URL string.
1657
58+
---
59+
1760
<a name="1.0.1"></a>
1861

1962
## [1.0.1](https://github.com/commonality/readme-inspector/compare/v1.0.0...v1.0.1) (2018-04-16)
@@ -24,13 +67,17 @@ All notable changes to this project will be documented in this file. See [standa
2467

2568
Replaced [`dotenv`][dotenv-url] with [`dotenv-extended`][dotenv-extended-url] in order to load default values.
2669

70+
---
71+
2772
<a name="1.0.0"></a>
2873

2974
## 1.0.0 (2018-04-12)
3075

3176
### Features
3277

33-
* **module:readme-inspector:** Verify the existence—and assess the quality—of README files
78+
* #### module:readme-inspector
79+
80+
Verify the existence—and assess the quality—of README files
3481

3582
> ![quote][octicon-quote] READMEs do more than explain how to use your project. They also
3683
> explain why your project matters, and what your users can do with it.
@@ -47,29 +94,29 @@ All notable changes to this project will be documented in this file. See [standa
4794
> licenses and attribution. If you don’t want to accept contributions, or
4895
> your project is not yet ready for production, write this information down. <sup><a href="#ref-1" title="View reference.">[1]</a></sup>
4996
50-
**Public API**
97+
* #### Public API
5198

5299
_Methods_
53100

54-
* `authenticate` - Sets GitHub credentials for all subsequent requests.
55-
* `check` - Attempts to GET and assess a README at a repo-root directory.
56-
* `getReadmeInfo` - Attempt to GET a README without assessing it.
57-
* `getReadmeScore` - Assess the quality of a README.
101+
> * `authenticate` - Sets GitHub credentials for all subsequent requests.
102+
> * `check` - Attempts to GET and assess a README at a repo-root directory.
103+
> * `getReadmeInfo` - Attempt to GET a README without assessing it.
104+
> * `getReadmeScore` - Assess the quality of a README.
58105
59106
_Properties_
60107

61-
* `ReadmeScore` - An API proxy wrapper for the readme-score-api.
62-
* `api` - A configurable Octokit instance.
108+
> * `ReadmeScore` - An API proxy wrapper for the readme-score-api.
109+
> * `api` - A configurable Octokit instance.
63110
64111
_Documentation_
65112

66-
Visit <https://github.com/commonality/readme-inspector/#readme> for
67-
more information about installation, usage, API, version,
68-
contributing guidelines, and licenses.
113+
> Visit <https://github.com/commonality/readme-inspector/#readme> for
114+
> more information about installation, usage, API, version,
115+
> contributing guidelines, and licenses.
69116
70117
_Commit_
71118

72-
([e04a07a](https://github.com/commonality/readme-inspector/commit/e04a07a)), closes [#1](https://github.com/commonality/readme-inspector/issues/1)
119+
> ([e04a07a](https://github.com/commonality/readme-inspector/commit/e04a07a)), closes [#1](https://github.com/commonality/readme-inspector/issues/1)
73120
74121
## References
75122

0 commit comments

Comments
 (0)