File tree 3 files changed +16
-10
lines changed 3 files changed +16
-10
lines changed Original file line number Diff line number Diff line change
1
+ import { deprecated } from '../../internal/deprecated' ;
1
2
import { ModuleBase } from '../../internal/module-base' ;
2
3
3
4
/**
@@ -24,12 +25,8 @@ export class ImageModule extends ModuleBase {
24
25
* @since 2.0.1
25
26
*/
26
27
avatar ( ) : string {
27
- const avatarMethod = this . faker . helpers . arrayElement ( [
28
- this . avatarLegacy ,
29
- this . avatarGitHub ,
30
- ] ) ;
31
-
32
- return avatarMethod ( ) ;
28
+ // Add new avatar providers here, when adding a new one.
29
+ return this . avatarGitHub ( ) ;
33
30
}
34
31
35
32
/**
@@ -55,9 +52,17 @@ export class ImageModule extends ModuleBase {
55
52
* // 'https://cloudflare-ipfs.com/ipfs/Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye/avatar/170.jpg'
56
53
*
57
54
* @since 8.0.0
55
+ *
56
+ * @deprecated The links are no longer working. Use `avatar()` instead.
58
57
*/
59
- // This implementation will change in the future when we tackle https://github.com/faker-js/faker/issues/465.
60
58
avatarLegacy ( ) : string {
59
+ deprecated ( {
60
+ deprecated : 'faker.image.avatarLegacy()' ,
61
+ proposed : 'faker.image.avatar()' ,
62
+ since : '9.0.1' ,
63
+ until : '10.0.0' ,
64
+ } ) ;
65
+
61
66
return `https://cloudflare-ipfs.com/ipfs/Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye/avatar/${ this . faker . number . int (
62
67
1249
63
68
) } .jpg`;
Original file line number Diff line number Diff line change 1
1
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
2
3
- exports [` image > 42 > avatar 1` ] = ` "https://cloudflare-ipfs. com/ipfs/Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye/avatar/1188.jpg "` ;
3
+ exports [` image > 42 > avatar 1` ] = ` "https://avatars.githubusercontent. com/u/37454012 "` ;
4
4
5
5
exports [` image > 42 > avatarGitHub 1` ] = ` "https://avatars.githubusercontent.com/u/37454012"` ;
6
6
@@ -76,7 +76,7 @@ exports[`image > 42 > urlPlaceholder > with width 1`] = `"https://via.placeholde
76
76
77
77
exports [` image > 42 > urlPlaceholder > with width and height 1` ] = ` "https://via.placeholder.com/128x128/8ead33/1ddf0f.webp?text=benevolentia%20attonbitus%20auctus"` ;
78
78
79
- exports [` image > 1211 > avatar 1` ] = ` "https://avatars.githubusercontent.com/u/89347165 "` ;
79
+ exports [` image > 1211 > avatar 1` ] = ` "https://avatars.githubusercontent.com/u/92852016 "` ;
80
80
81
81
exports [` image > 1211 > avatarGitHub 1` ] = ` "https://avatars.githubusercontent.com/u/92852016"` ;
82
82
@@ -152,7 +152,7 @@ exports[`image > 1211 > urlPlaceholder > with width 1`] = `"https://via.placehol
152
152
153
153
exports [` image > 1211 > urlPlaceholder > with width and height 1` ] = ` "https://via.placeholder.com/128x128/ed4fef/a7fbae.webp?text=dapifer%20usque%20unde"` ;
154
154
155
- exports [` image > 1337 > avatar 1` ] = ` "https://cloudflare-ipfs. com/ipfs/Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye/avatar/198.jpg "` ;
155
+ exports [` image > 1337 > avatar 1` ] = ` "https://avatars.githubusercontent. com/u/26202467 "` ;
156
156
157
157
exports [` image > 1337 > avatarGitHub 1` ] = ` "https://avatars.githubusercontent.com/u/26202467"` ;
158
158
Original file line number Diff line number Diff line change @@ -114,6 +114,7 @@ describe('image', () => {
114
114
115
115
describe ( 'avatarLegacy' , ( ) => {
116
116
it ( 'should return a random avatar url from cloudflare-ipfs' , ( ) => {
117
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
117
118
const avatarUrl = faker . image . avatarLegacy ( ) ;
118
119
119
120
expect ( avatarUrl ) . toBeTypeOf ( 'string' ) ;
You can’t perform that action at this time.
0 commit comments