11// main
22
3- const {
4- hasProperty,
5- } = require ( 'bellajs' ) ;
6-
73const {
84 extract,
95 hasProvider,
@@ -36,6 +32,10 @@ const PhotoTypeKeys = [
3632 ...required ,
3733] ;
3834
35+ const hasProperty = ( obj , key ) => {
36+ return Object . prototype . hasOwnProperty . call ( obj , key ) ;
37+ } ;
38+
3939const hasRichKeys = ( o ) => {
4040 return RichTypeKeys . every ( ( k ) => {
4141 return hasProperty ( o , k ) ;
@@ -68,7 +68,7 @@ const hasPhotoKeys = (o) => {
6868 try {
6969 await extract ( url ) ;
7070 } catch ( err ) {
71- expect ( err instanceof Error ) . toBe ( true ) ;
71+ expect ( err ) . toBeTruthy ( ) ;
7272 }
7373 } ) ;
7474 } ;
@@ -83,7 +83,7 @@ test(`test extract YouTube link`, async () => {
8383 const result = await extract ( url ) ;
8484 expect ( hasRichKeys ( result ) ) . toBe ( true ) ;
8585 } catch ( err ) {
86- expect ( err instanceof Error ) . toBe ( null ) ;
86+ expect ( err ) . toBe ( null ) ;
8787 }
8888} ) ;
8989
@@ -93,7 +93,7 @@ test(`test extract Flickr link`, async () => {
9393 const result = await extract ( url ) ;
9494 expect ( hasPhotoKeys ( result ) ) . toBe ( true ) ;
9595 } catch ( err ) {
96- expect ( err instanceof Error ) . toBe ( null ) ;
96+ expect ( err ) . toBe ( null ) ;
9797 }
9898} ) ;
9999
@@ -103,7 +103,7 @@ test(`test extract Flickr link with params`, async () => {
103103 const result = await extract ( url , { maxwidth : 640 , maxheight : 480 } ) ;
104104 expect ( hasPhotoKeys ( result ) ) . toBe ( true ) ;
105105 } catch ( err ) {
106- expect ( err instanceof Error ) . toBe ( null ) ;
106+ expect ( err ) . toBe ( null ) ;
107107 }
108108} ) ;
109109
0 commit comments