-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: status and statusDetails logic (#30)
- Loading branch information
Showing
26 changed files
with
344 additions
and
161 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
8 changes: 8 additions & 0 deletions
8
e2e/src/programmatic/grouping/server/controllers/__snapshots__/forgotPassword.test.ts.snap
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,8 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`POST /forgot-password should return 401 if user is not found 1`] = ` | ||
{ | ||
"code": 401, | ||
"seed": 0.06426173461501827, | ||
} | ||
`; |
4 changes: 3 additions & 1 deletion
4
e2e/src/programmatic/grouping/server/controllers/forgotPassword.test.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
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,40 @@ | ||
import { allure } from 'jest-allure2-reporter/api'; | ||
|
||
const dummyTest = () => expect(true).toBe(true); | ||
const passingAssertion = () => expect(2 + 2).toBe(4); | ||
const failingAssertion = () => expect(2 + 2).toBe(5); | ||
const failingSnapshot = () => expect({ seed: Math.random() }).toMatchSnapshot(); | ||
const brokenAssertion = () => { throw new Error('This assertion is broken'); }; | ||
|
||
type Fn = () => any; | ||
|
||
describe('Status tests', () => { | ||
describe('Simple', () => { | ||
test('passed', passingAssertion); | ||
test('failed assertion', failingAssertion); | ||
test('failed snapshot', failingSnapshot); | ||
test('broken', brokenAssertion); | ||
test.skip('skipped', passingAssertion); | ||
test.todo('todo'); | ||
}); | ||
|
||
describe.each([ | ||
['passing', passingAssertion], | ||
['failed assertion in a ', failingAssertion], | ||
['failed snapshot in a ', failingSnapshot], | ||
['broken', brokenAssertion], | ||
])('Status override in a %s', (_parentSuite, callback) => { | ||
describe.each([ | ||
['test', (callback: Fn) => (test('', callback), void 0)], | ||
['beforeAll hook', (callback: Fn) => (beforeAll(callback), test('', dummyTest), void 0)], | ||
['beforeEach hook', (callback: Fn) => (beforeEach(callback), test('', dummyTest), void 0)], | ||
['afterEach hook', (callback: Fn) => (afterEach(callback), test('', dummyTest), void 0)], | ||
['afterAll hook', (callback: Fn) => (afterAll(callback), test('', dummyTest), void 0)], | ||
])('%s', (_suite, hook) => { | ||
hook(function () { | ||
allure.status('unknown', { message: 'Custom message', trace: 'Custom trace' }); | ||
callback(); | ||
}); | ||
}); | ||
}); | ||
}); |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import type { TestInvocationMetadata } from 'jest-metadata'; | ||
|
||
import { STAGE } from '../constants'; | ||
|
||
export const getStage = (testInvocation: TestInvocationMetadata) => { | ||
let finished: boolean | undefined; | ||
for (const invocation of testInvocation.allInvocations()) { | ||
finished ??= true; | ||
|
||
const stage = invocation.get(STAGE); | ||
if (stage === 'interrupted') { | ||
return 'interrupted'; | ||
} | ||
if (stage !== 'finished') { | ||
finished = false; | ||
} | ||
} | ||
|
||
return finished ? 'finished' : undefined; | ||
}; |
Oops, something went wrong.