-
Notifications
You must be signed in to change notification settings - Fork 185
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add teacher/judge section to ilab form (#3777)
* Add teacher/judge section to ilab form * Resolve conflicts, address feedback * update zod validation for URL * Address comments * address feedback * change run name
- Loading branch information
1 parent
5fd48b6
commit e3b27a0
Showing
15 changed files
with
719 additions
and
120 deletions.
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
48 changes: 48 additions & 0 deletions
48
...ent/modelCustomizationForm/modelCustomizationFormSchema/__tests__/validationUtils.spec.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,48 @@ | ||
import { ModelCustomizationEndpointType } from '~/concepts/pipelines/content/modelCustomizationForm/modelCustomizationFormSchema/types'; | ||
import { | ||
TeacherJudgeFormData, | ||
teacherJudgeModel, | ||
} from '~/concepts/pipelines/content/modelCustomizationForm/modelCustomizationFormSchema/validationUtils'; | ||
|
||
describe('TeacherJudgeSchema', () => { | ||
it('should validate when it is public without token', () => { | ||
const field: TeacherJudgeFormData = { | ||
endpointType: ModelCustomizationEndpointType.PUBLIC, | ||
apiToken: '', | ||
modelName: 'test', | ||
endpoint: 'http://test.com', | ||
}; | ||
const result = teacherJudgeModel.safeParse(field); | ||
expect(result.success).toBe(true); | ||
}); | ||
it('should error when it is private without token', () => { | ||
const field: TeacherJudgeFormData = { | ||
endpointType: ModelCustomizationEndpointType.PRIVATE, | ||
apiToken: '', | ||
modelName: 'test', | ||
endpoint: 'http://test.com', | ||
}; | ||
const result = teacherJudgeModel.safeParse(field); | ||
expect(result.success).toBe(false); | ||
}); | ||
it('should validate when it is private with token', () => { | ||
const field: TeacherJudgeFormData = { | ||
endpointType: ModelCustomizationEndpointType.PRIVATE, | ||
apiToken: 'test', | ||
modelName: 'test', | ||
endpoint: 'http://test.com', | ||
}; | ||
const result = teacherJudgeModel.safeParse(field); | ||
expect(result.success).toBe(true); | ||
}); | ||
it('should error when the endpoint is not a uri', () => { | ||
const field: TeacherJudgeFormData = { | ||
endpointType: ModelCustomizationEndpointType.PRIVATE, | ||
apiToken: 'test', | ||
modelName: 'test', | ||
endpoint: 'not a uri', | ||
}; | ||
const result = teacherJudgeModel.safeParse(field); | ||
expect(result.success).toBe(false); | ||
}); | ||
}); |
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
Oops, something went wrong.