Skip to content

Commit 42a827e

Browse files
committed
refactor: remove displayError
1 parent 94777f9 commit 42a827e

File tree

3 files changed

+6
-14
lines changed

3 files changed

+6
-14
lines changed

site/src/components/Snackbar/index.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { displayError, isNotificationTextPrefixed, MsgType, NotificationMsg } from "./index"
1+
import { displaySuccess, isNotificationTextPrefixed, MsgType, NotificationMsg } from "./index"
22

33
describe("Snackbar", () => {
44
describe("isNotificationTextPrefixed", () => {
@@ -15,7 +15,7 @@ describe("Snackbar", () => {
1515
})
1616
})
1717

18-
describe("displayError", () => {
18+
describe("displaySuccess", () => {
1919
const originalWindowDispatchEvent = window.dispatchEvent
2020
let dispatchEventMock: jest.Mock
2121

@@ -47,13 +47,13 @@ describe("Snackbar", () => {
4747
it("can be called with only a title", () => {
4848
// Given
4949
const expected: NotificationMsg = {
50-
msgType: MsgType.Error,
50+
msgType: MsgType.Success,
5151
msg: "Test",
5252
additionalMsgs: undefined,
5353
}
5454

5555
// When
56-
displayError("Test")
56+
displaySuccess("Test")
5757

5858
// Then
5959
expect(dispatchEventMock).toBeCalledTimes(1)
@@ -63,13 +63,13 @@ describe("Snackbar", () => {
6363
it("can be called with a title and additional message", () => {
6464
// Given
6565
const expected: NotificationMsg = {
66-
msgType: MsgType.Error,
66+
msgType: MsgType.Success,
6767
msg: "Test",
6868
additionalMsgs: ["additional message"],
6969
}
7070

7171
// When
72-
displayError("Test", "additional message")
72+
displaySuccess("Test", "additional message")
7373

7474
// Then
7575
expect(dispatchEventMock).toBeCalledTimes(1)

site/src/components/Snackbar/index.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,3 @@ export const displayMsg = (msg: string, additionalMsg?: string): void => {
6666
export const displaySuccess = (msg: string, additionalMsg?: string): void => {
6767
dispatchNotificationEvent(MsgType.Success, msg, additionalMsg ? [additionalMsg] : undefined)
6868
}
69-
70-
export const displayError = (msg: string, additionalMsg?: string): void => {
71-
dispatchNotificationEvent(MsgType.Error, msg, additionalMsg ? [additionalMsg] : undefined)
72-
}

yarn.lock

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)