Skip to content

Commit 318a37d

Browse files
author
Daan Sprenkels
committed
Add a test for gravatar urls
Signed-off-by: Daan Sprenkels <[email protected]>
1 parent f9cc2ff commit 318a37d

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"main": "app.js",
66
"license": "AGPL-3.0",
77
"scripts": {
8-
"test": "npm run-script eslint && npm run-script jsonlint",
8+
"test": "npm run-script eslint && npm run-script jsonlint && mocha",
99
"eslint": "node_modules/.bin/eslint lib public app.js",
1010
"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",
1111
"standard": "echo 'standard is no longer being used, use `npm run eslint` instead!' && exit 1",
@@ -184,6 +184,7 @@
184184
"less": "^2.7.1",
185185
"less-loader": "^4.1.0",
186186
"mini-css-extract-plugin": "^0.4.1",
187+
"mocha": "^5.2.0",
187188
"optimize-css-assets-webpack-plugin": "^5.0.0",
188189
"script-loader": "^0.7.2",
189190
"string-loader": "^0.0.1",

test/letter-avatars.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
'use strict'
2+
3+
const assert = require('assert');
4+
const avatars = require('../lib/letter-avatars')
5+
6+
describe('generateAvatarURL()', function() {
7+
it('should return correct urls', function() {
8+
assert.equal(avatars.generateAvatarURL('Daan Sprenkels', '[email protected]', true), 'https://www.gravatar.com/avatar/d41b5f3508cc3f31865566a47dd0336b?s=400');
9+
assert.equal(avatars.generateAvatarURL('Daan Sprenkels', '[email protected]', false), 'https://www.gravatar.com/avatar/d41b5f3508cc3f31865566a47dd0336b?s=96');
10+
});
11+
});

0 commit comments

Comments
 (0)