Skip to content

Commit

Permalink
adding tests
Browse files Browse the repository at this point in the history
Signed-off-by: Tokesh <[email protected]>
  • Loading branch information
Tokesh committed Jan 5, 2025
1 parent 697127c commit 7064c38
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tools/src/tester/types/eval.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ export interface StoryEvaluation {
full_path: string
description: string
message?: string
pending?: string
chapters?: ChapterEvaluation[]
epilogues?: ChapterEvaluation[]
prologues?: ChapterEvaluation[]
Expand All @@ -44,6 +43,7 @@ export interface ChapterEvaluation {
overall: Evaluation,
operation?: Operation,
path?: string,
pending?: string,
request?: {
parameters?: Record<string, Evaluation>
request?: Evaluation
Expand Down
15 changes: 15 additions & 0 deletions tools/tests/tester/fixtures/evals/ignored/ignore.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
display_path: ignored/ignored.yaml
full_path: tools/tests/tester/fixtures/stories/ignored/ignore.yaml

result: PASSED
description: This story should ignored.
prologues: []
chapters:
- title: This PUT /{index} chapter should pending.
overall:
result: IGNORED
message: This chapter is ignored because it is not relevant to the current test.
epilogues:
- title: DELETE /books
overall:
result: PASSED
14 changes: 14 additions & 0 deletions tools/tests/tester/fixtures/stories/ignored/ignored.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
$schema: ../../../../../../json_schemas/test_story.schema.yaml

description: This story should ignored.
epilogues:
- path: /books
method: DELETE
status: [200, 404]
chapters:
- synopsis: This PUT /{index} chapter should pending.
path: /{index}
pending: This chapter is ignored because it is not relevant to the current test.
method: PUT
parameters:
index: books
6 changes: 6 additions & 0 deletions tools/tests/tester/integ/StoryEvaluator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ test('skipped/semver', async () => {
expect(actual).toEqual(expected)
})

test('ignored', async () => {
const actual = await load_actual_evaluation(story_evaluator, 'skipped/semver')
const expected = load_expected_evaluation('skipped/semver')
expect(actual).toEqual(expected)
})

test('with an unexpected error deserializing data', async () => {
opensearch_http_client.request = jest.fn().mockRejectedValue(new Error('This was unexpected.'))
const actual = await load_actual_evaluation(story_evaluator, 'passed/passed')
Expand Down
1 change: 1 addition & 0 deletions tools/tests/tester/integ/TestRunner.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ test('stories folder', async () => {
'error/prologue_error',
'failed/invalid_data',
'failed/not_found',
'ignored/ignore',
'passed/multiple_methods',
'passed/passed',
'passed/value_type',
Expand Down

0 comments on commit 7064c38

Please sign in to comment.