DefinitelyTyped/types/gravatar/gravatar-tests.ts
Andrew Casey 5f2ca8c55a
feat(gravatar): missing 1.8 version features (#42843)
- correct DT header and package version
- `profile_url` method
- `cdn` options property
- `forceProtocol` aligned with documented `protocol`
- adding new method resulted in module shape correction (export `url`
and `profile_url` directly from the module
- tests updated
- update tslint config

https://github.com/emerleite/node-gravatar#usage
https://github.com/emerleite/node-gravatar#examples
dd76e57087/Changelog.md (180)

Thanks!
2020-03-05 12:54:53 -08:00

22 lines
1.2 KiB
TypeScript

import gravatar = require('gravatar');
gravatar.url('email@example.com');
gravatar.url('email@example.com', { s: '200', r: 'pg', d: '404' });
gravatar.url('email@example.com', { size: '200', r: 'pg', d: '404' });
gravatar.url('email@example.com', { s: '200' });
gravatar.url('email@example.com', { default: '404' });
gravatar.url('email@example.com', { s: '200', rating: 'pg', d: '404' }, true);
gravatar.url('email@example.com', { s: '200', r: 'pg', default: '404' }, false);
gravatar.url('email@example.com', { d: '404' }, false);
gravatar.url('email@example.com', { forcedefault: 'y' }, false);
gravatar.url('email@example.com', { f: 'y' });
gravatar.url('email@example.com', { protocol: 'https' });
gravatar.url('email@example.com', { format: 'xml' });
gravatar.profile_url('email@example.com');
gravatar.profile_url('email@example.com', {});
gravatar.profile_url('email@example.com', {}, true);
gravatar.profile_url('emerleite@gmail.com', { protocol: 'https' });
gravatar.profile_url('emerleite@gmail.com', { protocol: 'http', format: 'qr' });
gravatar.url('email@example.com', { cdn: 'http://cdn-gravatar.wuweixing.com' });
gravatar.profile_url('email@example.com', { cdn: 'http://cdn-gravatar.wuweixing.com' });