-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #361 from cofacts/choosing-media-articles
refactor: combine processMedia and processImage
- Loading branch information
Showing
17 changed files
with
1,805 additions
and
2,082 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
import { ListArticlesInProcessMediaQuery } from 'typegen/graphql'; | ||
|
||
export const oneImageArticle: GqlResponse<ListArticlesInProcessMediaQuery> = { | ||
data: { | ||
ListArticles: { | ||
edges: [ | ||
{ | ||
score: 87, | ||
node: { | ||
articleType: 'IMAGE', | ||
attachmentUrl: 'http://foo/image.jpeg', | ||
id: 'image-article-1', | ||
}, | ||
mediaSimilarity: 0.87, | ||
highlight: null, | ||
}, | ||
], | ||
}, | ||
}, | ||
}; | ||
|
||
export const oneIdenticalImageArticle: GqlResponse<ListArticlesInProcessMediaQuery> = | ||
{ | ||
data: { | ||
ListArticles: { | ||
edges: [ | ||
{ | ||
score: 100, | ||
node: { | ||
articleType: 'IMAGE', | ||
attachmentUrl: 'http://foo/image.jpeg', | ||
id: 'image-article-1', | ||
}, | ||
mediaSimilarity: 1, | ||
highlight: null, | ||
}, | ||
], | ||
}, | ||
}, | ||
}; | ||
|
||
export const identicalImageAndTextFound: GqlResponse<ListArticlesInProcessMediaQuery> = | ||
{ | ||
data: { | ||
ListArticles: { | ||
edges: [ | ||
{ | ||
score: 100, | ||
mediaSimilarity: 1, | ||
node: { | ||
articleType: 'IMAGE', | ||
attachmentUrl: 'http://foo/image.jpeg', | ||
id: 'image-article-1', | ||
}, | ||
highlight: null, | ||
}, | ||
{ | ||
score: 87.6656, | ||
mediaSimilarity: 0, | ||
node: { | ||
articleType: 'TEXT', | ||
attachmentUrl: null, | ||
id: 'text-article-1', | ||
}, | ||
highlight: { | ||
text: 'Text matching <HIGHLIGHT>query transcript</HIGHLIGHT>', | ||
hyperlinks: [ | ||
{ | ||
title: | ||
'Hyperlink title matching <HIGHLIGHT>query transcript</HIGHLIGHT>', | ||
summary: | ||
'Hyperlink summary matching <HIGHLIGHT>query transcript</HIGHLIGHT>', | ||
}, | ||
], | ||
}, | ||
}, | ||
], | ||
}, | ||
}, | ||
}; | ||
|
||
export const twelveImageArticles: GqlResponse<ListArticlesInProcessMediaQuery> = | ||
{ | ||
data: { | ||
ListArticles: { | ||
edges: Array.from(Array(6)).reduce< | ||
NonNullable<ListArticlesInProcessMediaQuery['ListArticles']>['edges'] | ||
>( | ||
(arr) => | ||
arr.concat([ | ||
{ | ||
score: 100, | ||
mediaSimilarity: 1, | ||
node: { | ||
articleType: 'IMAGE', | ||
attachmentUrl: 'http://foo/image.jpeg', | ||
id: 'image-article-1', | ||
}, | ||
highlight: null, | ||
}, | ||
{ | ||
score: 87.6656, | ||
mediaSimilarity: 0.87, | ||
node: { | ||
articleType: 'IMAGE', | ||
attachmentUrl: 'http://foo/image2.jpeg', | ||
id: 'image-article-2', | ||
}, | ||
highlight: null, | ||
}, | ||
]), | ||
[] | ||
), | ||
}, | ||
}, | ||
}; | ||
|
||
export const notFound: GqlResponse<ListArticlesInProcessMediaQuery> = { | ||
data: { | ||
ListArticles: { | ||
edges: [], | ||
}, | ||
}, | ||
}; |
Oops, something went wrong.