Skip to content

Commit

Permalink
integration tests updates
Browse files Browse the repository at this point in the history
  • Loading branch information
ludeknovy committed Nov 10, 2023
1 parent 2529809 commit 937413a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/server/queries/scenario.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ export const selectOnlyMyScenarioShareTokens = (projectName: string, scenarioNam
}

export const createScenarioShareToken =
(projectName: string, scenarioName: string, token: string, userId: string, note = null) => {
(projectName: string, scenarioName: string, token: string, userId: string, note: string) => {
return {
text: `INSERT INTO jtl.scenario_share_tokens (scenario_id, token, note, created_by) VALUES (
(SELECT sc.id FROM jtl.scenario as sc
Expand Down
3 changes: 2 additions & 1 deletion src/server/routes/test-data-setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { ReportStatus } from "../queries/items.model"
import { StatusCode } from "../utils/status-code"
import { AllowedRoles } from "../middleware/authorization-middleware"
import { assignAllAdminsAsProjectMembers } from "../queries/user-project-access"

export class TestDataSetup {

routes(app: express.Application): void {
Expand Down Expand Up @@ -73,7 +74,7 @@ export class TestDataSetup {
const project = await db.one(getProject("test-project"))
await db.any(assignAllAdminsAsProjectMembers(project.id))
await db.any(createNewScenario("test-project", "test-scenario"))
await db.none(createScenarioShareToken("test-project", "test-scenario", token, uuidv4() ))
await db.none(createScenarioShareToken("test-project", "test-scenario", token, uuidv4(), "note"))

Check failure on line 77 in src/server/routes/test-data-setup.ts

View workflow job for this annotation

GitHub Actions / build

This line has a length of 121. Maximum allowed is 120
res.status(StatusCode.Ok).json({ token })
} else {
res.sendStatus(StatusCode.BadRequest)
Expand Down
4 changes: 2 additions & 2 deletions src/tests/integration/scenario.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,11 +225,11 @@ describe("Scenario", () => {
.send({
note: "my token note",
})
.expect(StatusCode.Ok)
.expect(StatusCode.Created)
})
})
describe(`GET /projects/{projectName}/scenarios/{scenarioName}/share-token`, () => {
it("should be able to create new token", async() => {
it("should be able to get tokens", async() => {
await stateSetup(States.ExistingScenario)
await request(__server__)
.get("/api/projects/test-project/scenarios/test-scenario/share-token")
Expand Down

0 comments on commit 937413a

Please sign in to comment.