Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ test("Do not mark as active if promote is not checked", async () => {
expect(updateActiveTemplateVersion).toBeCalledTimes(0)
})

test("The default version name is used when a new one is not used", async () => {
test("Patch request is not send when the name is not updated", async () => {
const user = userEvent.setup()
renderWithAuth(<TemplateVersionEditorPage />, {
extraRoutes: [
Expand Down Expand Up @@ -172,12 +172,12 @@ test("The default version name is used when a new one is not used", async () =>
})
await user.click(publishButton)
const publishDialog = await screen.findByTestId("dialog")
// It is using the name from the template version
const nameField = within(publishDialog).getByLabelText("Version name")
expect(nameField).toHaveValue(MockTemplateVersion.name)
// Publish
await user.click(
within(publishDialog).getByRole("button", { name: "Publish" }),
)
await waitFor(() => {
expect(patchTemplateVersion).toBeCalledWith("new-version-id", {
name: MockTemplateVersion.name,
})
})
expect(patchTemplateVersion).toBeCalledTimes(0)
})
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,10 @@ export const templateVersionEditorMachine = createMachine(
throw new Error("Template is not set")
}
await Promise.all([
API.patchTemplateVersion(version.id, { name }),
// Only do a patch if the name is different
name !== version.name
? API.patchTemplateVersion(version.id, { name })
: Promise.resolve(),
isActiveVersion
? API.updateActiveTemplateVersion(templateId, {
id: version.id,
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy