mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2025-12-11 20:02:09 +00:00
Make javascript mocha texttests work
This commit is contained in:
parent
c1638a56b8
commit
7b973f93dd
47
js-mocha/README.md
Normal file
47
js-mocha/README.md
Normal file
@ -0,0 +1,47 @@
|
||||
# Gilded Rose in Javascript with Mocha
|
||||
|
||||
## Getting started
|
||||
|
||||
Install dependencies
|
||||
|
||||
```sh
|
||||
npm install
|
||||
```
|
||||
|
||||
## Run the unit tests from the Command-Line
|
||||
|
||||
To run all tests
|
||||
|
||||
```sh
|
||||
npm test
|
||||
```
|
||||
|
||||
To run all tests in watch mode
|
||||
|
||||
```sh
|
||||
npm run test:watch
|
||||
```
|
||||
|
||||
To generate test coverage report
|
||||
|
||||
```sh
|
||||
npm run test:coverage
|
||||
```
|
||||
|
||||
## Run the TextTest fixture from the Command-Line
|
||||
|
||||
For e.g. 10 days:
|
||||
|
||||
```
|
||||
node test/texttest_fixture.js 10
|
||||
```
|
||||
|
||||
You should make sure the command shown above works when you execute it in a terminal before trying to use TextTest (see below).
|
||||
|
||||
|
||||
## Run the TextTest approval test that comes with this project
|
||||
|
||||
There are instructions in the [TextTest Readme](../texttests/README.md) for setting up TextTest. You will need to specify the Javascript-Jest executable and interpreter in [config.gr](../texttests/config.gr). Uncomment these lines:
|
||||
|
||||
executable:${TEXTTEST_HOME}/js-mocha/test/texttest_fixture.js
|
||||
interpreter:node
|
||||
@ -19,9 +19,10 @@ const days = Number(process.argv[2]) || 2;
|
||||
const gildedRose = new Shop(items);
|
||||
|
||||
console.log("OMGHAI!");
|
||||
for (let day = 0; day < days; day++) {
|
||||
console.log(`\n-------- day ${day} --------`);
|
||||
for (let day = 0; day < days + 1; day++) {
|
||||
console.log(`-------- day ${day} --------`);
|
||||
console.log("name, sellIn, quality");
|
||||
items.forEach(item => console.log(`${item.name}, ${item.sellIn}, ${item.quality}`));
|
||||
gildedRose.updateQuality();
|
||||
console.log("")
|
||||
}
|
||||
|
||||
@ -36,8 +36,12 @@ diff_program:meld
|
||||
#interpreter:python
|
||||
|
||||
# Settings for the Javascript Jest version
|
||||
executable:${TEXTTEST_HOME}/js-jest/test/texttest_fixture.js
|
||||
interpreter:node
|
||||
#executable:${TEXTTEST_HOME}/js-jest/test/texttest_fixture.js
|
||||
#interpreter:node
|
||||
|
||||
# Settings for the Javascript Mocha version
|
||||
#executable:${TEXTTEST_HOME}/js-mocha/test/texttest_fixture.js
|
||||
#interpreter:node
|
||||
|
||||
# Settings for the Julia version
|
||||
#executable:${TEXTTEST_HOME}/julia/texttest_fixture.jl
|
||||
|
||||
Loading…
Reference in New Issue
Block a user