-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
committing unit test cases for cookies, health and home
- Loading branch information
1 parent
7d89bab
commit 53645df
Showing
5 changed files
with
80 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { cookiesCy } from './index' | ||
|
||
describe('cookies index plugin - cy', () => { | ||
const server = { | ||
route: jest.fn() | ||
} | ||
|
||
test('should register cookies route', () => { | ||
cookiesCy.plugin.register(server) | ||
expect(server.route).toHaveBeenCalled() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { cookies } from './index' | ||
|
||
describe('cookies index plugin - en', () => { | ||
const server = { | ||
route: jest.fn() | ||
} | ||
|
||
test('should register cookies route', () => { | ||
cookies.plugin.register(server) | ||
expect(server.route).toHaveBeenCalled() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { healthController } from './controller' | ||
import { health } from './index' | ||
import Hapi from '@hapi/hapi' | ||
|
||
describe('health index plugin', () => { | ||
let server | ||
|
||
beforeAll(async () => { | ||
server = Hapi.server() | ||
await health.plugin.register(server) | ||
}) | ||
|
||
beforeEach(() => { | ||
jest.mock('./controller', () => ({ | ||
healthController: { | ||
handler: jest.fn(), | ||
options: {} | ||
} | ||
})) | ||
}) | ||
|
||
test('should register healthController route', () => { | ||
const routes = server.table() | ||
const healthControllerRoute = routes.find( | ||
(routes) => routes.path === '/health' && routes.method === 'get' | ||
) | ||
expect(healthControllerRoute).toBeDefined() | ||
expect(healthControllerRoute.settings.handler).toBe( | ||
healthController.handler | ||
) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { homeCy } from './index' | ||
|
||
describe('home index plugin - cy', () => { | ||
const server = { | ||
route: jest.fn() | ||
} | ||
|
||
test('should register home routes', () => { | ||
homeCy.plugin.register(server) | ||
expect(server.route).toHaveBeenCalled() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { home } from './index' | ||
|
||
describe('home index plugin - en', () => { | ||
const server = { | ||
route: jest.fn() | ||
} | ||
|
||
test('should register home routes', () => { | ||
home.plugin.register(server) | ||
expect(server.route).toHaveBeenCalled() | ||
}) | ||
}) |