You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+15-24Lines changed: 15 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -49,6 +49,21 @@ Algorithms in this repo should not be how-to examples for existing JavaScript pa
49
49
- There should be no spaces in filenames.
50
50
**Example:**`UserProfile.js` is allowed but `userprofile.js`,`Userprofile.js`,`user-Profile.js`,`userProfile.js` are not
51
51
52
+
#### Testing
53
+
54
+
Be confident that your code works. When was the last time you committed a code change, your build failed, and half of your app stopped working? Mine was last week. Writing tests for our Algorithms will help us ensure the implementations are air tight even after multiple fixes and code changes.
55
+
We use a NPM package [doctest](https://www.npmjs.com/package/doctest) to add basic testing functionality to our code. Doctests are simple structured comments that evaluate an function and ensure a required result.
56
+
57
+
The implementation of doctest is quite simple. You can easily learn it [here](https://www.npmjs.com/package/doctest).
58
+
59
+
It is advised that you add the Doctests in a multiline comment just after the Algorithm description.
60
+
For Code Structure reference see [this file](https://github.com/TheAlgorithms/Javascript/blob/master/Sorts/BubbleSort.js).
61
+
62
+
You can run the doctest by using the command
63
+
```
64
+
$ doctest MyFile.js // if that fails, try: npx doctest MyFile.js
65
+
```
66
+
52
67
#### Coding Style
53
68
54
69
To maximize the readability and correctness of our code, we require that new submissions follow [JavaScript Standard Style](https://standardjs.com/)
@@ -80,30 +95,6 @@ To maximize the readability and correctness of our code, we require that new sub
80
95
- Please use 'console.log()'
81
96
- We strongly recommend the use of ECMAScript 6
82
97
- Avoid importing external libraries for basic algorithms. Only use those libraries for complicated algorithms.
83
-
84
-
#### Testing
85
-
86
-
Be confident that your code works. When was the last time you committed a code change, your build failed, and half of your app stopped working? Mine was last week. Writing tests for our Algorithms will help us ensure the implementations are air tight even after multiple fixes and code changes.
87
-
We use a NPM package [doctest](https://www.npmjs.com/package/doctest) to add basic testing functionality to our code. Doctests are simple structured comments that evaluate an function and ensure a required result.
88
-
89
-
The implementation of doctest is quite simple. You can easily learn it [here](https://www.npmjs.com/package/doctest).
90
-
91
-
It is advised that you add the Doctests in a multiline comment just after the Algorithm description.
92
-
/**
93
-
* Algorithm Description Here
94
-
* The Wikipedia Link
95
-
*/
96
-
/**
97
-
* Doctests Here
98
-
*/
99
-
For Code Structure reference see [this file](https://github.com/TheAlgorithms/Javascript/blob/master/Sorts/BubbleSort.js).
100
-
101
-
You can run the doctest by using the command
102
-
```
103
-
$ doctest MyFile.js // if that fails, try: npx doctest MyFile.js
104
-
```
105
-
106
-
107
98
- Most importantly,
108
99
- **Be consistent in the use of these guidelines when submitting.**
0 commit comments