-
Notifications
You must be signed in to change notification settings - Fork 897
chore: change build audit log string to be clearer #6093
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
f9d28b0
7f71c2a
0125d4f
c182357
7ca2a8b
57c1529
ec75fb7
d0ba8eb
3a34e5e
a2b461e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,8 +8,12 @@ import { | |
} from "testHelpers/entities" | ||
import { AuditLogDescription } from "./AuditLogDescription" | ||
import { AuditLogRow } from "../AuditLogRow" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These tests aren't perfect - I was having difficulty testing strings with an embedded |
||
import { render } from "../../../testHelpers/renderHelpers" | ||
import { render } from "testHelpers/renderHelpers" | ||
import { screen } from "@testing-library/react" | ||
import { i18n } from "i18n" | ||
|
||
const t = (str: string, variables?: Record<string, unknown>) => | ||
i18n.t<string>(str, variables) | ||
|
||
const getByTextContent = (text: string) => { | ||
return screen.getByText((_, element) => { | ||
|
@@ -25,9 +29,8 @@ describe("AuditLogDescription", () => { | |
it("renders the correct string for a workspace create audit log", async () => { | ||
render(<AuditLogDescription auditLog={MockAuditLog} />) | ||
|
||
expect( | ||
getByTextContent("TestUser created workspace bruno-dev"), | ||
).toBeDefined() | ||
expect(screen.getByText("TestUser created workspace")).toBeDefined() | ||
expect(screen.getByText("bruno-dev")).toBeDefined() | ||
}) | ||
|
||
it("renders the correct string for a workspace_build stop audit log", async () => { | ||
|
@@ -55,27 +58,59 @@ describe("AuditLogDescription", () => { | |
auditLog={MockWorkspaceCreateAuditLogForDifferentOwner} | ||
/>, | ||
) | ||
|
||
expect( | ||
getByTextContent( | ||
`TestUser created workspace bruno-dev on behalf of ${MockWorkspaceCreateAuditLogForDifferentOwner.additional_fields.workspace_owner}`, | ||
screen.getByText( | ||
`on behalf of ${MockWorkspaceCreateAuditLogForDifferentOwner.additional_fields.workspace_owner}`, | ||
{ exact: false }, | ||
), | ||
).toBeDefined() | ||
}) | ||
it("renders the correct string for successful login", async () => { | ||
render(<AuditLogRow auditLog={MockAuditLogSuccessfulLogin} />) | ||
expect(getByTextContent(`TestUser logged in`)).toBeDefined() | ||
|
||
expect( | ||
screen.getByText( | ||
t("auditLog:table.logRow.description.unlinkedAuditDescription", { | ||
truncatedDescription: `${MockAuditLogSuccessfulLogin.user?.username} logged in`, | ||
target: "", | ||
onBehalfOf: undefined, | ||
}).trim(), | ||
), | ||
).toBeInTheDocument() | ||
|
||
const statusPill = screen.getByRole("status") | ||
expect(statusPill).toHaveTextContent("201") | ||
}) | ||
it("renders the correct string for unsuccessful login for a known user", async () => { | ||
render(<AuditLogRow auditLog={MockAuditLogUnsuccessfulLoginKnownUser} />) | ||
expect(getByTextContent(`TestUser logged in`)).toBeDefined() | ||
|
||
expect( | ||
screen.getByText( | ||
t("auditLog:table.logRow.description.unlinkedAuditDescription", { | ||
truncatedDescription: `${MockAuditLogUnsuccessfulLoginKnownUser.user?.username} logged in`, | ||
target: "", | ||
onBehalfOf: undefined, | ||
}).trim(), | ||
), | ||
).toBeInTheDocument() | ||
|
||
const statusPill = screen.getByRole("status") | ||
expect(statusPill).toHaveTextContent("401") | ||
}) | ||
it("renders the correct string for unsuccessful login for an unknown user", async () => { | ||
render(<AuditLogRow auditLog={MockAuditLogUnsuccessfulLoginUnknownUser} />) | ||
expect(getByTextContent(`an unknown user logged in`)).toBeDefined() | ||
|
||
expect( | ||
screen.getByText( | ||
t("auditLog:table.logRow.description.unlinkedAuditDescription", { | ||
truncatedDescription: "an unknown user logged in", | ||
target: "", | ||
onBehalfOf: undefined, | ||
}).trim(), | ||
), | ||
).toBeInTheDocument() | ||
|
||
const statusPill = screen.getByRole("status") | ||
expect(statusPill).toHaveTextContent("401") | ||
}) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export {AuditLogDescription} from "./AuditLogDescription" | ||
export { AuditLogDescription } from "./AuditLogDescription" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
export {AuditLogDiff} from './AuditLogDiff' | ||
export {determineGroupDiff} from './auditUtils' | ||
export { AuditLogDiff } from "./AuditLogDiff" | ||
export { determineGroupDiff } from "./auditUtils" |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5165,13 +5165,13 @@ caniuse-lite@^1.0.30001109, caniuse-lite@^1.0.30001304, caniuse-lite@^1.0.300014 | |
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001431.tgz#e7c59bd1bc518fae03a4656be442ce6c4887a795" | ||
integrity sha512-zBUoFU0ZcxpvSt9IU66dXVT/3ctO1cy4y9cscs1szkPlcWb6pasYM144GqrUygUbT+k7cmUCW61cvskjcv0enQ== | ||
|
||
canvas@2.10.0: | ||
version "2.10.0" | ||
resolved "https://registry.yarnpkg.com/canvas/-/canvas-2.10.0.tgz#5f48c8d1ff86c96356809097020336c3a1ccce27" | ||
integrity sha512-A0RPxLcH0pPKAY2VN243LdCNcOJXAT8n7nJnN7TZMGv9OuF8we9wfpWgVT/eFMzi+cDYf/384w4BpfjGCD9aKQ== | ||
canvas@^2.11.0: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We're getting changes here because I ran into this issue and had to re-add |
||
version "2.11.0" | ||
resolved "https://registry.yarnpkg.com/canvas/-/canvas-2.11.0.tgz#7f0c3e9ae94cf469269b5d3a7963a7f3a9936434" | ||
integrity sha512-bdTjFexjKJEwtIo0oRx8eD4G2yWoUOXP9lj279jmQ2zMnTQhT8C3512OKz3s+ZOaQlLbE7TuVvRDYDB3Llyy5g== | ||
dependencies: | ||
"@mapbox/node-pre-gyp" "^1.0.0" | ||
nan "^2.15.0" | ||
nan "^2.17.0" | ||
simple-get "^3.0.3" | ||
|
||
capture-exit@^2.0.0: | ||
|
@@ -10783,6 +10783,11 @@ minipass@^3.0.0, minipass@^3.1.1: | |
dependencies: | ||
yallist "^4.0.0" | ||
|
||
minipass@^4.0.0: | ||
version "4.0.2" | ||
resolved "https://registry.yarnpkg.com/minipass/-/minipass-4.0.2.tgz#26fc3364d5ea6cb971c6e5259eac67a0887510d1" | ||
integrity sha512-4Hbzei7ZyBp+1aw0874YWpKOubZd/jc53/XU+gkYry1QV+VvrbO8icLM5CUtm4F0hyXn85DXYKEMIS26gitD3A== | ||
|
||
minizlib@^2.1.1: | ||
version "2.1.2" | ||
resolved "https://registry.yarnpkg.com/minizlib/-/minizlib-2.1.2.tgz#e90d3466ba209b932451508a11ce3d3632145931" | ||
|
@@ -10907,7 +10912,7 @@ mute-stream@0.0.8: | |
resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.8.tgz#1630c42b2251ff81e2a283de96a5497ea92e5e0d" | ||
integrity sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA== | ||
|
||
nan@^2.12.1, nan@^2.15.0: | ||
nan@^2.12.1, nan@^2.17.0: | ||
version "2.17.0" | ||
resolved "https://registry.yarnpkg.com/nan/-/nan-2.17.0.tgz#c0150a2368a182f033e9aa5195ec76ea41a199cb" | ||
integrity sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ== | ||
|
@@ -13669,7 +13674,7 @@ tar-stream@^2.0.1: | |
inherits "^2.0.3" | ||
readable-stream "^3.1.1" | ||
|
||
tar@^6.0.2, tar@^6.1.11: | ||
tar@^6.0.2: | ||
version "6.1.12" | ||
resolved "https://registry.yarnpkg.com/tar/-/tar-6.1.12.tgz#3b742fb05669b55671fb769ab67a7791ea1a62e6" | ||
integrity sha512-jU4TdemS31uABHd+Lt5WEYJuzn+TJTCBLljvIAHZOz6M9Os5pJ4dD+vRFLxPa/n3T0iEFzpi+0x1UfuDZYbRMw== | ||
|
@@ -13681,6 +13686,18 @@ tar@^6.0.2, tar@^6.1.11: | |
mkdirp "^1.0.3" | ||
yallist "^4.0.0" | ||
|
||
tar@^6.1.11: | ||
version "6.1.13" | ||
resolved "https://registry.yarnpkg.com/tar/-/tar-6.1.13.tgz#46e22529000f612180601a6fe0680e7da508847b" | ||
integrity sha512-jdIBIN6LTIe2jqzay/2vtYLlBHa3JF42ot3h1dW8Q0PaAG4v8rm0cvpVePtau5C6OKXGGcgO9q2AMNSWxiLqKw== | ||
dependencies: | ||
chownr "^2.0.0" | ||
fs-minipass "^2.0.0" | ||
minipass "^4.0.0" | ||
minizlib "^2.1.1" | ||
mkdirp "^1.0.3" | ||
yallist "^4.0.0" | ||
|
||
telejson@^6.0.8: | ||
version "6.0.8" | ||
resolved "https://registry.yarnpkg.com/telejson/-/telejson-6.0.8.tgz#1c432db7e7a9212c1fbd941c3e5174ec385148f7" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're getting changes here because I ran into this issue and had to re-add canvas.