Add observability for LLM topic context inclusion (#1038)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: thomasnordquist <7721625+thomasnordquist@users.noreply.github.com> Co-authored-by: Thomas Nordquist <thomasnordquist@users.noreply.github.com>
This commit is contained in:
@@ -5,10 +5,10 @@ import * as path from 'path'
|
||||
|
||||
/**
|
||||
* AboutDialog License Compliance Tests
|
||||
*
|
||||
*
|
||||
* These tests verify that the About dialog properly displays required
|
||||
* attribution information as mandated by the CC-BY-ND-4.0 license.
|
||||
*
|
||||
*
|
||||
* CC-BY-ND-4.0 (Creative Commons Attribution-NoDerivatives 4.0 International):
|
||||
* - BY (Attribution): Must credit the original author (Thomas Nordquist)
|
||||
* - ND (NoDerivatives): Cannot create derivative works without permission
|
||||
@@ -48,45 +48,45 @@ describe('AboutDialog License Compliance', () => {
|
||||
// CC-BY-ND-4.0 Attribution (BY) requirement:
|
||||
// Must credit the original author "Thomas Nordquist"
|
||||
const hasAuthor = aboutDialogContent.includes('Thomas Nordquist')
|
||||
|
||||
|
||||
if (!hasAuthor) {
|
||||
throw new Error(
|
||||
'LICENSE VIOLATION: Author attribution "Thomas Nordquist" is missing. ' +
|
||||
'This violates the CC-BY-ND-4.0 Attribution (BY) requirement. ' +
|
||||
'The author must be properly credited in the About dialog.'
|
||||
'This violates the CC-BY-ND-4.0 Attribution (BY) requirement. ' +
|
||||
'The author must be properly credited in the About dialog.'
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
expect(hasAuthor).to.be.true
|
||||
})
|
||||
|
||||
it('removing license notice violates CC-BY-ND-4.0 license', () => {
|
||||
// CC-BY-ND-4.0 requires the license identifier to be displayed
|
||||
const hasLicense = aboutDialogContent.includes('CC-BY-ND-4.0')
|
||||
|
||||
|
||||
if (!hasLicense) {
|
||||
throw new Error(
|
||||
'LICENSE VIOLATION: License notice "CC-BY-ND-4.0" is missing. ' +
|
||||
'This violates CC-BY-ND-4.0 license notice requirements. ' +
|
||||
'The license identifier must be displayed in the About dialog.'
|
||||
'This violates CC-BY-ND-4.0 license notice requirements. ' +
|
||||
'The license identifier must be displayed in the About dialog.'
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
expect(hasLicense).to.be.true
|
||||
})
|
||||
|
||||
it('removing LICENSE NOTICE comment violates CC-BY-ND-4.0 license', () => {
|
||||
// CC-BY-ND-4.0 requires attribution notice in source code
|
||||
const hasLicenseNotice = aboutDialogContent.includes('LICENSE NOTICE')
|
||||
|
||||
|
||||
if (!hasLicenseNotice) {
|
||||
throw new Error(
|
||||
'LICENSE VIOLATION: LICENSE NOTICE comment is missing from source code. ' +
|
||||
'This violates CC-BY-ND-4.0 source code attribution requirements. ' +
|
||||
'The LICENSE NOTICE comment must be retained in the component source.'
|
||||
'This violates CC-BY-ND-4.0 source code attribution requirements. ' +
|
||||
'The LICENSE NOTICE comment must be retained in the component source.'
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
expect(hasLicenseNotice).to.be.true
|
||||
})
|
||||
})
|
||||
@@ -94,39 +94,39 @@ describe('AboutDialog License Compliance', () => {
|
||||
|
||||
/**
|
||||
* AboutDialog Functionality Tests
|
||||
*
|
||||
*
|
||||
* These tests verify that the About dialog is accessible and functional.
|
||||
*/
|
||||
describe('AboutDialog Accessibility', () => {
|
||||
const detailsTabPath = path.join(__dirname, 'Sidebar', 'DetailsTab.tsx')
|
||||
const appPath = path.join(__dirname, 'App.tsx')
|
||||
|
||||
|
||||
it('should be accessible from the DetailsTab component', () => {
|
||||
const detailsTabContent = fs.readFileSync(detailsTabPath, 'utf-8')
|
||||
|
||||
|
||||
// Verify the About button exists in DetailsTab
|
||||
expect(detailsTabContent).to.include('About')
|
||||
|
||||
|
||||
// Verify it triggers the toggle action
|
||||
expect(detailsTabContent).to.include('toggleAboutDialogVisibility')
|
||||
})
|
||||
|
||||
it('should be integrated in the App component', () => {
|
||||
const appContent = fs.readFileSync(appPath, 'utf-8')
|
||||
|
||||
|
||||
// Verify AboutDialog is imported
|
||||
expect(appContent).to.include('AboutDialog')
|
||||
|
||||
|
||||
// Verify it's rendered with state
|
||||
expect(appContent).to.include('aboutDialogVisible')
|
||||
})
|
||||
|
||||
it('should have About button with Info icon in DetailsTab', () => {
|
||||
const detailsTabContent = fs.readFileSync(detailsTabPath, 'utf-8')
|
||||
|
||||
|
||||
// Verify the button text
|
||||
expect(detailsTabContent).to.include('About MQTT Explorer')
|
||||
|
||||
|
||||
// Verify Info icon is used
|
||||
expect(detailsTabContent).to.match(/import.*Info.*from.*@mui\/icons-material/)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user