-
Notifications
You must be signed in to change notification settings - Fork 12
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: implement renderer 2024 provider #177
Merged
Merged
Changes from 13 commits
Commits
Show all changes
47 commits
Select commit
Hold shift + click to select a range
61ed51f
feat: add compute hash utils
ldhyen99 034f537
feat: add prefix in compute hash function
ldhyen99 ca1e3f4
feat: create plugin that contain hash
ldhyen99 14fc4b8
test: add unit test for compute hash
ldhyen99 a49ee9c
feat: implement renderer 2024 provider
ducpm511 f02873d
feat: add plugin to agent.yml
ldhyen99 b572e1d
refactor: delete compute hash function in tools package
ldhyen99 fdac6c1
chore: update ts config file
ldhyen99 ec3746f
Merge branch 'feat/add_compute_hash_utils' into renderer2024
ducpm511 9a033de
feat: implement new UI for renderer on demo explorer
ducpm511 713e011
Merge branch 'next' into renderer2024
ducpm511 5afd5ab
feat: updated unit tests
ducpm511 caef6c5
feat: handled error
ducpm511 4001ef1
Merge branch 'next' into renderer2024
ducpm511 d3581cc
feat: updated according to feedback
ducpm511 2f05cca
feat: updated renderer to be able to use extractRendererMethod function
ducpm511 85b33a0
refactor: clean up renderer
ducpm511 7b4ac12
Merge branch 'next' into renderer2024
ducpm511 65b9a24
refactor: adding missing template
ducpm511 c55545e
Merge branch 'next' into renderer2024
ducpm511 fec182d
refactor: renamed provider name; replace context url
ducpm511 8891f63
Merge branch 'next' into renderer2024
ducpm511 edcfcc0
refactor: updated provider according to computeHash function changes
ducpm511 2e6ec77
refactor: implement to support mediaQuery and refactor code
ducpm511 360f777
refactor: enhance the performance by set documentLoader
namhoang1604 ac6094c
refactor: updated response type and rename test file
ducpm511 e3e78cc
refactor: updated default contexts for renderer
ducpm511 ac71f0b
fix: display rendered template on UI and return renderedTemplate fielβ¦
ldhyen99 607a359
refactor: update render template 2024
ducpm511 78445c2
feat: update demo-explorer to support render template 2024
ducpm511 e035b72
Merge branch 'next' into renderer2024
ducpm511 ab74283
chore: updated unit test corresponding to changes of render provider
ducpm511 d3bcc29
chore: fix renderer to address unit test
ducpm511 2080de3
Merge branch 'next' into renderer2024
ducpm511 ebca386
Merge branch 'next' into renderer2024
ducpm511 cce6eb6
chore: added more test case to increase the coverage
ducpm511 1d602ad
chore: added more unit test cases
ducpm511 5fbca74
Merge branch 'next' into renderer2024
ducpm511 46f7bcf
chore: reduced uncovered count for statement
ducpm511 c370dea
Merge branch 'next' into renderer2024
namhoang1604 a65aae1
chore: removed duplicate test case
ducpm511 d4e31b1
refactor: use the inline template if failed to fetch it from url.
ducpm511 75c4d42
fix: removed duplicate test case and implement mock fetch to simulateβ¦
ducpm511 aa46d60
fix: wrong expected result
ducpm511 50c45c4
chore: removed meanless comment
ducpm511 ed4ec10
refactor: enhance the render template 2024
namhoang1604 25ff963
test: adjust to update the unit test of renderer plugin
namhoang1604 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
46 changes: 46 additions & 0 deletions
46
packages/renderer/__tests__/providers/web-rendering-template-2024.test.ts
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,46 @@ | ||
import { WebRenderingTemplate2024 } from '/Users/ducpm/GoSource/projects/project_vckit/project-vckit/packages/renderer/src/providers/web-rendering-template-2024'; | ||
|
||
describe('WebRenderingTemplate2024', () => { | ||
let renderer: WebRenderingTemplate2024; | ||
|
||
beforeEach(() => { | ||
renderer = new WebRenderingTemplate2024(); | ||
}); | ||
|
||
it('should return an p tag with error message if the template is not provided', async () => { | ||
const result = await renderer.renderCredential({}); | ||
|
||
expect(result).toBe( | ||
'<p style="color: red">Error: Failed to fetch template or no template provided</p>', | ||
); | ||
}); | ||
|
||
it('should render the template with the credential data', async () => { | ||
const template = '<p>{{name}}</p>'; | ||
const document = { name: 'John Doe' }; | ||
|
||
const renderedContent = await renderer.renderCredential({ | ||
template, | ||
document, | ||
}); | ||
|
||
expect(renderedContent).toBe('<p>John Doe</p>'); | ||
}); | ||
|
||
it('should return an p tag with error message if the template and the digestMultibase are not the same', async () => { | ||
const template = '<p>{{name}}</p>'; | ||
const document = { name: 'John Doe' }; | ||
const digestMultibase = '123'; | ||
const result = await renderer.renderCredential({ | ||
template, | ||
document, | ||
digestMultibase, | ||
}); | ||
|
||
expect(result).toBe( | ||
'<p style="color: red">Error: Template hash does not match the provided digest</p>', | ||
); | ||
}); | ||
|
||
// Add more tests here for different scenarios | ||
}); |
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import { Renderer } from './renderer.js'; | ||
import { WebRenderingTemplate2022 } from './providers/web-rendering-template-2022.js'; | ||
import { WebRenderingTemplate2024 } from './providers/web-rendering-template-2024.js'; | ||
|
||
export { Renderer, WebRenderingTemplate2022 }; | ||
export { Renderer, WebRenderingTemplate2022, WebRenderingTemplate2024 }; | ||
export { RenderDefaultContexts } from './render-default-contexts.js'; |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove if it does not use