Browse Source

Fixed browser tests and added not to README

pull/134/head
james.cryer 7 years ago
parent
commit
85c140798f
  1. 3
      README.md
  2. 7
      chai-tests/main_spec.js

3
README.md

@ -193,6 +193,9 @@ To run the tests on Node (using Jest), type:
npm run test npm run test
``` ```
There are also some in-browser tests. To run these install and run a http-server such as [http-server](https://github.com/indexzero/http-server) from the root of the project. Then in the browser, navigate to `localhost:8080/chai-tests/test.html`, open up the developer console to see the results.
#### Dockerfile #### Dockerfile
For convenience I've added a simple Dockerfile to run the NodeJS tests in an Ubuntu container For convenience I've added a simple Dockerfile to run the NodeJS tests in an Ubuntu container

7
chai-tests/main_spec.js

@ -24,7 +24,7 @@ function request_success() {
expect(data.dimensionDifference.height).to.equal(0); expect(data.dimensionDifference.height).to.equal(0);
expect(data.dimensionDifference.width).to.equal(0); expect(data.dimensionDifference.width).to.equal(0);
expect(data.isSameDimensions).to.be.true; expect(data.isSameDimensions).to.be.true;
expect(data.misMatchPercentage).to.equal('8.63'); expect(data.misMatchPercentage).to.include('8.6');
resolve(); resolve();
}); });
}); });
@ -41,7 +41,7 @@ function base64_string() {
expect(data.dimensionDifference.height).to.equal(0); expect(data.dimensionDifference.height).to.equal(0);
expect(data.dimensionDifference.width).to.equal(0); expect(data.dimensionDifference.width).to.equal(0);
expect(data.isSameDimensions).to.be.true; expect(data.isSameDimensions).to.be.true;
expect(data.misMatchPercentage).to.equal('8.63'); expect(data.misMatchPercentage).to.include('8.6');
resolve(); resolve();
}); });
}); });
@ -53,8 +53,7 @@ function request_404() {
.compareTo('../demoassets/404-image.jpg') .compareTo('../demoassets/404-image.jpg')
.onComplete(function(data) { .onComplete(function(data) {
console.info('Reached oncomplete for request_404'); console.info('Reached oncomplete for request_404');
console.log(data); expect(data).to.deep.equal({ error: '[object Event]' });
expect(data).to.deep.equal({ error: 'Image load error.' });
resolve(); resolve();
}); });
}); });

Loading…
Cancel
Save