Skip to content

Commit

Permalink
Merge pull request #611 from danactive/update-deps
Browse files Browse the repository at this point in the history
Update next-test-api-route-handler v4
  • Loading branch information
danactive committed Apr 20, 2024
2 parents 38a0a87 + e45e6c2 commit c2a1663
Show file tree
Hide file tree
Showing 9 changed files with 872 additions and 610 deletions.
2 changes: 2 additions & 0 deletions .vercelignore
@@ -0,0 +1,2 @@
/api
/ui
10 changes: 7 additions & 3 deletions __tests__/api/album.test.ts
@@ -1,13 +1,17 @@
/**
* @jest-environment node
*/

import { testApiHandler } from 'next-test-api-route-handler'

import config from '../../config.json'
import handler from '../../pages/api/galleries/[gallery]/albums/[album]'
import pagesHandler from '../../pages/api/galleries/[gallery]/albums/[album]'

describe('Album endpoint', () => {
describe('Expect result', () => {
test('* GET has album', async () => {
await testApiHandler({
handler,
pagesHandler,
test: async ({ fetch }) => {
const response = await fetch({ method: 'GET' })
const result = await response.json()
Expand All @@ -25,7 +29,7 @@ describe('Album endpoint', () => {
describe('Expect error', () => {
test('* POST verb is denied', async () => {
await testApiHandler({
handler,
pagesHandler,
test: async ({ fetch }) => {
const response = await fetch({ method: 'POST' })
const result = await response.json()
Expand Down
10 changes: 7 additions & 3 deletions __tests__/api/albums.test.ts
@@ -1,13 +1,17 @@
/**
* @jest-environment node
*/

import { testApiHandler } from 'next-test-api-route-handler'

import config from '../../config.json'
import handler from '../../pages/api/galleries/[gallery]/albums'
import pagesHandler from '../../pages/api/galleries/[gallery]/albums'

describe('Albums endpoint', () => {
describe('Expect result', () => {
test('* GET has albums', async () => {
await testApiHandler({
handler,
pagesHandler,
test: async ({ fetch }) => {
const response = await fetch({ method: 'GET' })
const result = await response.json()
Expand All @@ -25,7 +29,7 @@ describe('Albums endpoint', () => {
describe('Expect error', () => {
test('* POST verb is denied', async () => {
await testApiHandler({
handler,
pagesHandler,
test: async ({ fetch }) => {
const response = await fetch({ method: 'POST' })
const result = await response.json()
Expand Down
10 changes: 7 additions & 3 deletions __tests__/api/galleries.test.ts
@@ -1,12 +1,16 @@
/**
* @jest-environment node
*/

import { testApiHandler } from 'next-test-api-route-handler'

import handler from '../../pages/api/galleries'
import pagesHandler from '../../pages/api/galleries'

describe('Galleries endpoint', () => {
describe('Expect result', () => {
test('* GET has galleries', async () => {
await testApiHandler({
handler,
pagesHandler,
test: async ({ fetch }) => {
const response = await fetch({ method: 'GET' })
const result = await response.json()
Expand All @@ -23,7 +27,7 @@ describe('Galleries endpoint', () => {
describe('Expect error', () => {
test('* POST verb is denied', async () => {
await testApiHandler({
handler,
pagesHandler,
test: async ({ fetch }) => {
const response = await fetch({ method: 'POST' })
const result = await response.json()
Expand Down
10 changes: 7 additions & 3 deletions __tests__/api/gallery.test.ts
@@ -1,13 +1,17 @@
/**
* @jest-environment node
*/

import { testApiHandler } from 'next-test-api-route-handler'

import config from '../../config.json'
import handler from '../../pages/api/galleries/[gallery]'
import pagesHandler from '../../pages/api/galleries/[gallery]'

describe('Gallery endpoint', () => {
describe('Expect result', () => {
test('* GET has gallery', async () => {
await testApiHandler({
handler,
pagesHandler,
test: async ({ fetch }) => {
const response = await fetch({ method: 'GET' })
const result = await response.json()
Expand All @@ -24,7 +28,7 @@ describe('Gallery endpoint', () => {
describe('Expect error', () => {
test('* POST verb is denied', async () => {
await testApiHandler({
handler,
pagesHandler,
test: async ({ fetch }) => {
const response = await fetch({ method: 'POST' })
const result = await response.json()
Expand Down

0 comments on commit c2a1663

Please sign in to comment.