-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2313 from akhilmhdh/feat/test-import
Feat/test import
- Loading branch information
Showing
24 changed files
with
2,308 additions
and
706 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { seedData1 } from "@app/db/seed-data"; | ||
|
||
const createPolicy = async (dto: { name: string; secretPath: string; approvers: string[]; approvals: number }) => { | ||
const res = await testServer.inject({ | ||
method: "POST", | ||
url: `/api/v1/secret-approvals`, | ||
headers: { | ||
authorization: `Bearer ${jwtAuthToken}` | ||
}, | ||
body: { | ||
workspaceId: seedData1.project.id, | ||
environment: seedData1.environment.slug, | ||
name: dto.name, | ||
secretPath: dto.secretPath, | ||
approvers: dto.approvers, | ||
approvals: dto.approvals | ||
} | ||
}); | ||
|
||
expect(res.statusCode).toBe(200); | ||
return res.json().approval; | ||
}; | ||
|
||
describe("Secret approval policy router", async () => { | ||
test("Create policy", async () => { | ||
const policy = await createPolicy({ | ||
secretPath: "/", | ||
approvals: 1, | ||
approvers: [seedData1.id], | ||
name: "test-policy" | ||
}); | ||
|
||
expect(policy.name).toBe("test-policy"); | ||
}); | ||
}); |
Oops, something went wrong.