Skip to content
This repository has been archived by the owner on Sep 12, 2023. It is now read-only.

Commit

Permalink
unit(server): prepare test to trim destroy routes
Browse files Browse the repository at this point in the history
  • Loading branch information
KennethTrecy committed Sep 15, 2022
1 parent 1507fb2 commit 3412e5e
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions server/helpers/extract_route_info.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,28 @@ describe("Helpers: Extract route info", () => {
expect(purpose).toBe("api")
})

it("can trim destroy route", () => {
const root = "/sample"
const currentPath = `${root}/api/destroy.delete.ts`

const { method, path, purpose } = extractRouteInfo(currentPath, root)

expect(method).toBe("delete")
expect(path).toBe("/api")
expect(purpose).toBe("api")
})

it("can trim subdestroy route", () => {
const root = "/sample"
const currentPath = `${root}/api/user/destroy.delete.ts`

const { method, path, purpose } = extractRouteInfo(currentPath, root)

expect(method).toBe("delete")
expect(path).toBe("/api/user")
expect(purpose).toBe("api")
})

it("can trim restore route", () => {
const root = "/sample"
const currentPath = `${root}/api/restore.patch.ts`
Expand Down

0 comments on commit 3412e5e

Please sign in to comment.