-
Notifications
You must be signed in to change notification settings - Fork 272
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Blueprints] Translate GitHub.com file URLs into CORS-accessible raw.…
…githubusercontent.com (#1810)
- Loading branch information
Showing
2 changed files
with
73 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { UrlResource } from './resources'; | ||
|
||
describe('UrlResource', () => { | ||
it('should create a new instance of UrlResource', () => { | ||
const resource = new UrlResource({ | ||
resource: 'url', | ||
url: 'https://example.com', | ||
caption: 'Example', | ||
}); | ||
expect(resource).toBeInstanceOf(UrlResource); | ||
}); | ||
|
||
it('should translate github.com URLs into raw.githubusercontent.com URLs', () => { | ||
const resource = new UrlResource({ | ||
resource: 'url', | ||
url: 'https://github.com/WordPress/wordpress-develop/blob/trunk/src/wp-includes/version.php', | ||
caption: 'Example', | ||
}); | ||
expect(resource.getURL()).toBe( | ||
'https://raw.githubusercontent.com/WordPress/wordpress-develop/trunk/src/wp-includes/version.php' | ||
); | ||
}); | ||
}); |
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