-
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.
- Loading branch information
1 parent
f82ad1b
commit 403a6dd
Showing
6 changed files
with
727 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import type { Config } from '@jest/types'; | ||
|
||
const config: Config.InitialOptions = { | ||
roots: ['.'], | ||
preset: 'ts-jest', | ||
testMatch: ['**/?(*.)+(spec|test).[jt]s'], | ||
testEnvironment: 'node', | ||
clearMocks: true, | ||
maxWorkers: 1, | ||
snapshotFormat: { | ||
printBasicPrototype: false, | ||
}, | ||
}; | ||
|
||
export default config; |
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,34 @@ | ||
import { generateOembedMetadata } from '../index'; | ||
|
||
describe('Test Generate Oembed metadata', () => { | ||
it('should generate Oembed metadata for a code snippet', () => { | ||
// GIVEN | ||
const snippet = { id: 'snippet_id', name: 'snippet-name.java' }; | ||
const SNIPPET_RENDERER_URL = 'https://embed.sharingan.dev'; | ||
const WEB_APP_URL = 'https://sharingan.dev'; | ||
|
||
// WHEN | ||
const result = generateOembedMetadata({ | ||
snippet, | ||
snippetRendererURL: SNIPPET_RENDERER_URL, | ||
webAppURL: WEB_APP_URL, | ||
}); | ||
|
||
// THEN | ||
expect(result).toMatchInlineSnapshot(` | ||
{ | ||
"height": 500, | ||
"html": "<iframe width="750" height="500" src="https://embed.sharingan.dev/snippets/snippet_id" style="width:750px; height:500px; border:0; border-radius: 4px; overflow:hidden;" sandbox="allow-modals allow-forms allow-popups allow-scripts allow-same-origin"></iframe>", | ||
"provider_name": "Sharingan", | ||
"provider_url": "https://sharingan.dev", | ||
"thumbnail_height": "720", | ||
"thumbnail_url": "https://sharingan.dev/assets/og.png", | ||
"thumbnail_width": "1280", | ||
"title": "snippet-name.java", | ||
"type": "rich", | ||
"version": "1.0", | ||
"width": 750, | ||
} | ||
`); | ||
}); | ||
}); |
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,8 @@ | ||
{ | ||
"$schema": "https://json.schemastore.org/tsconfig", | ||
"extends": "./tsconfig.json", | ||
"exclude": [ | ||
"node_modules", | ||
"./src/**/*.test.ts" | ||
] | ||
} |
Oops, something went wrong.