Skip to content

Commit cb10b65

Browse files
committed
docs: update unit test instructions
1 parent a67ef65 commit cb10b65

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

Readme.md

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -541,19 +541,19 @@ string, otherwise it will throw.
541541
This option is also required when fetching big numbers from the database, otherwise
542542
you will get values rounded to hundreds or thousands due to the precision limit.
543543

544-
##Getting the number of affected rows.
544+
## Getting the number of affected rows.
545545

546546
You can get the number of affected rows from an insert, update or delete statement.
547547

548548
```js
549549
connection.query('DELETE FROM posts WHERE title = "wrong"', function (err, result) {
550550
if (err) throw err;
551551

552-
console.log(result.affectedRows);
552+
console.log('deleted ' + result.affectedRows + ' rows');
553553
})
554554
```
555555

556-
##Geting the number of changed rows.
556+
## Getting the number of changed rows.
557557

558558
You can get the number of changed rows from an update statement.
559559

@@ -564,7 +564,7 @@ whose values were not changed.
564564
connection.query('UPDATE posts SET ...', function (err, response) {
565565
if (err) throw err;
566566

567-
console.log(result.changedRows);
567+
console.log('changed ' + result.changedRows + ' rows');
568568
})
569569
```
570570

@@ -1020,23 +1020,15 @@ will have:
10201020

10211021
## Running unit tests
10221022

1023-
Set the environment variables `MYSQL_DATABASE`, `MYSQL_HOST`, `MYSQL_PORT`, `MYSQL_USER` and `MYSQL_PASSWORD`. (You may want to put these in a `config.sh` file and source it when you run the tests). Then run `make test`.
1023+
Set the environment variables `MYSQL_DATABASE`, `MYSQL_HOST`, `MYSQL_PORT`, `MYSQL_USER` and `MYSQL_PASSWORD`. Then run `npm test`.
10241024

10251025
For example, if you have an installation of mysql running on localhost:3306 and no password set for the `root` user, run:
10261026

10271027
```
10281028
mysql -u root -e "CREATE DATABASE IF NOT EXISTS node_mysql_test"
1029-
MYSQL_HOST=localhost MYSQL_PORT=3306 MYSQL_DATABASE=node_mysql_test MYSQL_USER=root MYSQL_PASSWORD= make test
1029+
MYSQL_HOST=localhost MYSQL_PORT=3306 MYSQL_DATABASE=node_mysql_test MYSQL_USER=root MYSQL_PASSWORD= npm test
10301030
```
10311031

1032-
## Running unit tests on windows
1033-
1034-
* Edit the variables in the file ```make.bat``` according to your system and mysql-settings.
1035-
* Make sure the database (e.g. 'test') you want to use exists and the user you entered has the proper rights to use the test database. (E.g. do not forget to execute the SQL-command ```FLUSH PRIVILEGES``` after you have created the user.)
1036-
* In a DOS-box (or CMD-shell) in the folder of your application run ```npm install mysql --dev``` or in the mysql folder (```node_modules\mysql```), run ```npm install --dev```. (This will install additional developer-dependencies for node-mysql.)
1037-
* Run ```npm test mysql``` in your applications folder or ```npm test``` in the mysql subfolder.
1038-
* If you want to log the output into a file use ```npm test mysql > test.log``` or ```npm test > test.log```.
1039-
10401032
## Todo
10411033

10421034
* Prepared statements

0 commit comments

Comments
 (0)