Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(embed): handle snippet not found #53

Merged
merged 6 commits into from
Oct 17, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: failing tests
  • Loading branch information
tericcabrel committed Oct 17, 2022
commit 88528e8abc553a516d3361bd50ad661dcc435741
18 changes: 12 additions & 6 deletions packages/embed/src/renderer/content/tests/preview-template.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import { Args, generateHTMLPreview } from '../preview-template';

jest.mock('../utils', () => {
return {
generateRandomString: () => 'random-id',
};
});

describe('Test generateHTMLPreview()', () => {
it('should generates the html preview for a code snippet', () => {
// GIVEN
Expand Down Expand Up @@ -38,23 +44,23 @@ describe('Test generateHTMLPreview()', () => {
<title>Sharingan - helpers.ts</title>
<link rel="stylesheet" type="text/css" href="https://cdn.com/sharigan/style.css" />
</head>
<body data-id="4D3Wsb">
<body data-id="random-id">
<div class="ctner">
<div class="ctner-header">
<div>helpers.ts</div>
<div>view on <a href="https://sharingan.dev" target="_blank">Sharingan</a></div>
</div>
<textarea id="raw-code-4D3Wsb" class="hidden" rows="1" cols="1">export const hashPassword = (password: string): string => {
<textarea id="raw-code-random-id" class="hidden" rows="1" cols="1">export const hashPassword = (password: string): string => {
const SALT_ROUNDS = 10;

return bcrypt.hashSync(password, SALT_ROUNDS);
};</textarea>
<div class="code-editor-container" id="code-4D3Wsb" style="border: solid 1px #f5f5f5; background-color: #f5f5f5">
<button id="btn-copy-4D3Wsb" class="btn-copy hidden" style="">
<svg class="ic show" id="ic-copy-4D3Wsb" fill="none" stroke="#fff" viewBox="0 0 24 24" xmlns="http:https://www.w3.org/2000/svg">
<div class="code-editor-container" id="code-random-id" style="border: solid 1px #f5f5f5; background-color: #f5f5f5">
<button id="btn-copy-random-id" class="btn-copy hidden" style="">
<svg class="ic show" id="ic-copy-random-id" fill="none" stroke="#fff" viewBox="0 0 24 24" xmlns="http:https://www.w3.org/2000/svg">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"></path>
</svg>
<svg class="ic hidden" id="ic-copied-4D3Wsb" fill="none" stroke="#10B981" viewBox="0 0 24 24" xmlns="http:https://www.w3.org/2000/svg">
<svg class="ic hidden" id="ic-copied-random-id" fill="none" stroke="#10B981" viewBox="0 0 24 24" xmlns="http:https://www.w3.org/2000/svg">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"></path>
</svg>
</button>
Expand Down