-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
back compatibility with old style jest runtime api (via #955)
- Loading branch information
Showing
19 changed files
with
389 additions
and
22 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
20 changes: 20 additions & 0 deletions
20
packages/allure-jest/test/spec/runtime/legacy/attachments.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { expect, it } from "@jest/globals"; | ||
import { runJestInlineTest } from "../../../utils"; | ||
|
||
it("handles json attachment", async () => { | ||
const { tests, attachments } = await runJestInlineTest(` | ||
it("json", async () => { | ||
await allure.attachment("Request body", JSON.stringify({ foo: "bar" }), "application/json"); | ||
}); | ||
`); | ||
|
||
expect(tests).toHaveLength(1); | ||
expect(tests[0].attachments).toHaveLength(1); | ||
|
||
const [attachment] = tests[0].attachments; | ||
|
||
expect(attachment.name).toBe("Request body"); | ||
expect(Buffer.from(attachments[attachment.source] as string, "base64").toString("utf8")).toBe( | ||
JSON.stringify({ foo: "bar" }), | ||
); | ||
}); |
24 changes: 24 additions & 0 deletions
24
packages/allure-jest/test/spec/runtime/legacy/description.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { expect, it } from "@jest/globals"; | ||
import { runJestInlineTest } from "../../../utils"; | ||
|
||
it("sets description", async () => { | ||
const { tests } = await runJestInlineTest(` | ||
it("description", async () => { | ||
await allure.description("foo"); | ||
}) | ||
`); | ||
|
||
expect(tests).toHaveLength(1); | ||
expect(tests[0].description).toBe("foo"); | ||
}); | ||
|
||
it("sets html description", async () => { | ||
const { tests } = await runJestInlineTest(` | ||
it("descriptionHtml", async () => { | ||
await allure.descriptionHtml("foo"); | ||
}) | ||
`); | ||
|
||
expect(tests).toHaveLength(1); | ||
expect(tests[0].descriptionHtml).toBe("foo"); | ||
}); |
15 changes: 15 additions & 0 deletions
15
packages/allure-jest/test/spec/runtime/legacy/historyId.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { describe, expect, it } from "@jest/globals"; | ||
import { runJestInlineTest } from "../../../utils"; | ||
|
||
describe("historyId", () => { | ||
it("historyId", async () => { | ||
const { tests } = await runJestInlineTest(` | ||
it("historyId", async () => { | ||
await allure.historyId("foo"); | ||
}) | ||
`); | ||
|
||
expect(tests).toHaveLength(1); | ||
expect(tests[0].historyId).toBe("foo"); | ||
}); | ||
}); |
39 changes: 39 additions & 0 deletions
39
packages/allure-jest/test/spec/runtime/legacy/labels.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { expect, it } from "@jest/globals"; | ||
import { LabelName } from "allure-js-commons"; | ||
import { runJestInlineTest } from "../../../utils"; | ||
|
||
it("sets labels", async () => { | ||
const { tests } = await runJestInlineTest(` | ||
it("label", async () => { | ||
await allure.label("foo", "bar"); | ||
await allure.allureId("foo"); | ||
await allure.epic("foo"); | ||
await allure.feature("foo"); | ||
await allure.layer("foo"); | ||
await allure.owner("foo"); | ||
await allure.parentSuite("foo"); | ||
await allure.subSuite("foo"); | ||
await allure.suite("foo"); | ||
await allure.severity("foo"); | ||
await allure.story("foo"); | ||
await allure.tag("foo"); | ||
await allure.labels({ name: "test", value: "testValue" }, { name: "test2", value: "testValue2" }); | ||
}) | ||
`); | ||
|
||
expect(tests).toHaveLength(1); | ||
expect(tests[0].labels).toContainEqual({ name: "foo", value: "bar" }); | ||
expect(tests[0].labels).toContainEqual({ name: LabelName.ALLURE_ID, value: "foo" }); | ||
expect(tests[0].labels).toContainEqual({ name: LabelName.EPIC, value: "foo" }); | ||
expect(tests[0].labels).toContainEqual({ name: LabelName.FEATURE, value: "foo" }); | ||
expect(tests[0].labels).toContainEqual({ name: LabelName.LAYER, value: "foo" }); | ||
expect(tests[0].labels).toContainEqual({ name: LabelName.OWNER, value: "foo" }); | ||
expect(tests[0].labels).toContainEqual({ name: LabelName.PARENT_SUITE, value: "foo" }); | ||
expect(tests[0].labels).toContainEqual({ name: LabelName.SUB_SUITE, value: "foo" }); | ||
expect(tests[0].labels).toContainEqual({ name: LabelName.SUITE, value: "foo" }); | ||
expect(tests[0].labels).toContainEqual({ name: LabelName.SEVERITY, value: "foo" }); | ||
expect(tests[0].labels).toContainEqual({ name: LabelName.STORY, value: "foo" }); | ||
expect(tests[0].labels).toContainEqual({ name: LabelName.TAG, value: "foo" }); | ||
expect(tests[0].labels).toContainEqual({ name: "test", value: "testValue" }); | ||
expect(tests[0].labels).toContainEqual({ name: "test2", value: "testValue2" }); | ||
}); |
49 changes: 49 additions & 0 deletions
49
packages/allure-jest/test/spec/runtime/legacy/links.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { expect, it } from "@jest/globals"; | ||
import { LinkType } from "allure-js-commons"; | ||
import { runJestInlineTest } from "../../../utils"; | ||
|
||
it("sets links", async () => { | ||
const { tests } = await runJestInlineTest(` | ||
it("link", async () => { | ||
await allure.link("https://allurereport.org"); | ||
await allure.issue("1"); | ||
await allure.issue("https://example.org/issues/2"); | ||
await allure.tms("1"); | ||
await allure.tms("https://example.org/tasks/2"); | ||
await allure.links(...[{ url:"https://allurereport.org/1" }, { url:"https://allurereport.org/2" }]); | ||
}) | ||
`); | ||
|
||
expect(tests).toHaveLength(1); | ||
expect(tests).toEqual([ | ||
expect.objectContaining({ | ||
links: [ | ||
{ | ||
url: "https://allurereport.org", | ||
}, | ||
{ | ||
url: "https://example.org/issues/1", | ||
type: LinkType.ISSUE, | ||
}, | ||
{ | ||
url: "https://example.org/issues/2", | ||
type: LinkType.ISSUE, | ||
}, | ||
{ | ||
url: "https://example.org/tasks/1", | ||
type: LinkType.TMS, | ||
}, | ||
{ | ||
url: "https://example.org/tasks/2", | ||
type: LinkType.TMS, | ||
}, | ||
{ | ||
url: "https://allurereport.org/1", | ||
}, | ||
{ | ||
url: "https://allurereport.org/2", | ||
}, | ||
], | ||
}), | ||
]); | ||
}); |
35 changes: 35 additions & 0 deletions
35
packages/allure-jest/test/spec/runtime/legacy/parameters.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { expect, it } from "@jest/globals"; | ||
import { runJestInlineTest } from "../../../utils"; | ||
|
||
it("sets parameters", async () => { | ||
const { tests } = await runJestInlineTest(` | ||
it("parameter", async () => { | ||
await allure.parameter("param1", "paramValue1"); | ||
await allure.parameter("param2", "paramValue2", {excluded:true}); | ||
await allure.parameter("param3", "paramValue3", {mode:"masked", excluded:true}); | ||
await allure.parameter("param4", "paramValue4", {mode:"hidden"}); | ||
}) | ||
`); | ||
|
||
expect(tests).toHaveLength(1); | ||
expect(tests).toEqual( | ||
expect.arrayContaining([ | ||
expect.objectContaining({ | ||
parameters: [ | ||
{ name: "param1", value: "paramValue1" }, | ||
{ excluded: true, name: "param2", value: "paramValue2" }, | ||
{ excluded: true, mode: "masked", name: "param3", value: "paramValue3" }, | ||
{ mode: "hidden", name: "param4", value: "paramValue4" }, | ||
], | ||
}), | ||
expect.objectContaining({ | ||
parameters: [ | ||
{ name: "param1", value: "paramValue1" }, | ||
{ excluded: true, name: "param2", value: "paramValue2" }, | ||
{ excluded: true, mode: "masked", name: "param3", value: "paramValue3" }, | ||
{ mode: "hidden", name: "param4", value: "paramValue4" }, | ||
], | ||
}), | ||
]), | ||
); | ||
}); |
Oops, something went wrong.