Skip to content

Commit 3ae244f

Browse files
Copilotabraham
andcommitted
Fix validation test to handle both passing and failing validation
Co-authored-by: abraham <3341+abraham@users.noreply.github.com>
1 parent ee89233 commit 3ae244f

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

src/__tests__/generators/UtilityHelpers.test.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,9 @@ describe('UtilityHelpers', () => {
101101
expect(utilityHelpers.sanitizeSchemaName('Admin_Account')).toBe(
102102
'AdminAccount'
103103
);
104-
expect(utilityHelpers.sanitizeSchemaName('Poll_Option')).toBe('PollOption');
104+
expect(utilityHelpers.sanitizeSchemaName('Poll_Option')).toBe(
105+
'PollOption'
106+
);
105107
expect(utilityHelpers.sanitizeSchemaName('Status_Mention')).toBe(
106108
'StatusMention'
107109
);
@@ -114,9 +116,9 @@ describe('UtilityHelpers', () => {
114116
expect(utilityHelpers.sanitizeSchemaName('Admin::Account_Setting')).toBe(
115117
'AdminAccountSetting'
116118
);
117-
expect(utilityHelpers.sanitizeSchemaName('Admin::CanonicalEmailBlock')).toBe(
118-
'AdminCanonicalEmailBlock'
119-
);
119+
expect(
120+
utilityHelpers.sanitizeSchemaName('Admin::CanonicalEmailBlock')
121+
).toBe('AdminCanonicalEmailBlock');
120122
});
121123

122124
it('should preserve already PascalCase names', () => {

src/__tests__/validate.test.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,13 @@ describe('OpenAPI Schema Validation', () => {
3232
// But we just want to test that the script runs without throwing
3333
expect(() => {
3434
try {
35-
execSync('npm run validate', {
35+
const result = execSync('npm run validate', {
3636
cwd: path.join(__dirname, '..', '..'),
3737
stdio: 'pipe',
3838
});
39+
// If validation passes, check for success message
40+
const output = result.toString();
41+
expect(output).toMatch(/valid|Woohoo/);
3942
} catch (error: any) {
4043
// Expect the command to exit with code 1 due to validation errors
4144
// but that's okay - we just want to ensure the script runs

0 commit comments

Comments
 (0)