Skip to content

Commit

Permalink
fix: address CRs
Browse files Browse the repository at this point in the history
  • Loading branch information
kobenguyent committed Oct 8, 2024
1 parent 38f949b commit 16cabe3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
8 changes: 2 additions & 6 deletions packages/ui/src/components/RequestPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1131,7 +1131,7 @@ export default {
this.urlPreview = url !== '' && url.trim() !== '' ? url : 'No URL'
},
async generateTests() {
let generatedTestScripts
const generatedTestScripts = await generateTestScripts()

const pluginData = this.$store.state.plugins.workspace.find(plugin =>
plugin.collectionId === this.activeTab._id && plugin.type === 'script'
Expand All @@ -1140,8 +1140,6 @@ export default {
const { pre_request = '', post_request = '' } = pluginData?.code || {}

try {
generatedTestScripts = await generateTestScripts()

const updatedPostRequest = `${post_request}\n${generatedTestScripts}`.trim()

const pluginPayload = {
Expand All @@ -1159,15 +1157,13 @@ export default {
} else {
this.$store.commit('updatePlugin', {
_id: pluginData._id,
...pluginPayload
code: pluginPayload.code
})
}

this.$toast.success('Test scripts are generated successfully.')
} catch (e) {
this.$toast.error(`Failed to generate test scripts: ${e.message}`)
} finally {
generatedTestScripts = null
}
}
},
Expand Down
1 change: 0 additions & 1 deletion packages/ui/src/components/Sidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ export default {
pluginManagerShow: false,
generateCodeModalCollectionItem: null,
generateCodeModalShow: false,
generateTestsModalCollectionItem: null,
createNewList: [
{
'type': 'option',
Expand Down

0 comments on commit 16cabe3

Please sign in to comment.