generated from IBM/template-graphql-typescript
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update data extract handling of Discovery responses (#142)
- Update default similarity-check url - Strip html tags and urls from each discovery passage Signed-off-by: Sean Sundberg <[email protected]>
- Loading branch information
Showing
8 changed files
with
65 additions
and
15 deletions.
There are no files selected for viewing
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 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 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 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 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 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 @@ | ||
export * from './strip-urls' |
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,37 @@ | ||
import {stripUrls} from "./strip-urls"; | ||
|
||
describe('strip-urls', () => { | ||
describe('Given stripUrls', () => { | ||
const url = 'https://host.com/path/to/file.html' | ||
|
||
describe('when "{url}" provided', () => { | ||
test('then return ""', () => { | ||
expect(stripUrls(url)).toEqual('') | ||
}) | ||
}) | ||
|
||
describe('when "http://host.com/path/to/file.html" provided', () => { | ||
test('then return ""', () => { | ||
expect(stripUrls('http://host.com/path/to/file.html')).toEqual('') | ||
}) | ||
}) | ||
|
||
describe('when "This is a test {url}." provided', () => { | ||
test('then return "This is a test "', () => { | ||
expect(stripUrls(`This is a test ${url}.`)).toEqual('This is a test ') | ||
}) | ||
}) | ||
|
||
describe('when "This is a test {url})" provided', () => { | ||
test('then return "This is a test "', () => { | ||
expect(stripUrls(`This is a test ${url})`)).toEqual('This is a test ') | ||
}) | ||
}) | ||
|
||
describe('when "This is a test {url} )" provided', () => { | ||
test('then return "This is a test )"', () => { | ||
expect(stripUrls(`This is a test ${url} )`)).toEqual('This is a test )') | ||
}) | ||
}) | ||
}) | ||
}) |
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,3 @@ | ||
export const stripUrls = (text: string): string => { | ||
return text.replace(/https?:\/\/[\n\S]+/g, '');; | ||
} |