diff options
author | Daan Sprenkels | 2018-12-22 14:10:40 +0100 |
---|---|---|
committer | Daan Sprenkels | 2018-12-22 19:09:45 +0100 |
commit | 318a37d41c64faa0ed57e913a0ae4e83592da1e5 (patch) | |
tree | 496ba31396568db34b5b5c70115a0f6cf88fa5b0 | |
parent | f9cc2ff0ef56aa5f0a655f9209321460748ba621 (diff) |
Add a test for gravatar urls
Signed-off-by: Daan Sprenkels <hello@dsprenkels.com>
-rw-r--r-- | package.json | 3 | ||||
-rw-r--r-- | test/letter-avatars.js | 11 |
2 files changed, 13 insertions, 1 deletions
diff --git a/package.json b/package.json index cf1e7068..4fffa579 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "main": "app.js", "license": "AGPL-3.0", "scripts": { - "test": "npm run-script eslint && npm run-script jsonlint", + "test": "npm run-script eslint && npm run-script jsonlint && mocha", "eslint": "node_modules/.bin/eslint lib public app.js", "jsonlint": "find . -not -path './node_modules/*' -type f -name '*.json' -o -type f -name '*.json.example' | while read json; do echo $json ; jq . $json; done", "standard": "echo 'standard is no longer being used, use `npm run eslint` instead!' && exit 1", @@ -184,6 +184,7 @@ "less": "^2.7.1", "less-loader": "^4.1.0", "mini-css-extract-plugin": "^0.4.1", + "mocha": "^5.2.0", "optimize-css-assets-webpack-plugin": "^5.0.0", "script-loader": "^0.7.2", "string-loader": "^0.0.1", diff --git a/test/letter-avatars.js b/test/letter-avatars.js new file mode 100644 index 00000000..4948dec0 --- /dev/null +++ b/test/letter-avatars.js @@ -0,0 +1,11 @@ +'use strict' + +const assert = require('assert'); +const avatars = require('../lib/letter-avatars') + +describe('generateAvatarURL()', function() { + it('should return correct urls', function() { + assert.equal(avatars.generateAvatarURL('Daan Sprenkels', 'hello@dsprenkels.com', true), 'https://www.gravatar.com/avatar/d41b5f3508cc3f31865566a47dd0336b?s=400'); + assert.equal(avatars.generateAvatarURL('Daan Sprenkels', 'hello@dsprenkels.com', false), 'https://www.gravatar.com/avatar/d41b5f3508cc3f31865566a47dd0336b?s=96'); + }); +}); |