Skip to content
This repository was archived by the owner on Jan 20, 2020. It is now read-only.

Commit d7f80f2

Browse files
author
Luciano Nooijen
committed
Improved NPM Module tests
1 parent fa0c409 commit d7f80f2

File tree

1 file changed

+33
-32
lines changed

1 file changed

+33
-32
lines changed

tests/index.test.ts

Lines changed: 33 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,36 @@
1-
// const nodeBlog = require('../');
2-
// const { authors, auth, users, articles } = require('../');
3-
// const { Authors } = require('../controllers');
1+
const nodeBlog = require('../');
2+
const { authors, auth, users, articles } = require('../');
43

5-
// const client = process.env.DB_CLIENT_TEST;
6-
// const host = process.env.DB_HOST_TEST;
7-
// const user = process.env.DB_USER_TEST;
8-
// const database = process.env.DB_NAME_TEST;
9-
// const password = process.env.DB_PASS_TEST;
10-
// const debug = process.env.KNEX_DEBUG;
4+
const client = process.env.DB_CLIENT_TEST;
5+
const host = process.env.DB_HOST_TEST;
6+
const user = process.env.DB_USER_TEST;
7+
const database = process.env.DB_NAME_TEST;
8+
const password = process.env.DB_PASS_TEST;
9+
const debug = process.env.KNEX_DEBUG === 'true';
1110

12-
// const nodeBlogArguments = { client, host, user, database, password, debug };
13-
// const blog = nodeBlog(client, host, user, database, password, debug);
11+
const nodeBlogArguments = { client, host, user, database, password, debug };
12+
const blog = nodeBlog(client, host, user, database, password, debug);
1413

15-
// describe('NodeBlog NPM module', () => {
16-
// test('NodeBlog to create a knex instance', () => {
17-
// expect(typeof blog).toBe('function');
18-
// });
19-
// test('Blog authors should work', async () => {
20-
// expect.assertions(3);
21-
// expect(typeof await authors.list(blog)).toBe('array');
22-
// expect(await authors.list(blog)).toEqual(Authors.list(blog));
23-
// expect(typeof await authors.get(blog, 1)).toBe('object');
24-
// });
25-
// test('Blog users should work', async () => {
26-
// expect.assertions(2);
27-
// expect(typeof await users.list(blog)).toBe('array');
28-
// expect(typeof await users.get(blog, 1)).toBe('object');
29-
// });
30-
// test('Blog articles should work', async () => {
31-
// expect.assertions(2);
32-
// expect(typeof await articles.list(blog)).toBe('array');
33-
// expect(typeof await articles.get(blog, 1)).toBe('object');
34-
// });
35-
// });
14+
describe('NodeBlog NPM module', () => {
15+
test('NodeBlog to create a knex instance', () => {
16+
expect(typeof blog).toBe('function');
17+
});
18+
test('Blog authors should work', async () => {
19+
const list = await authors.list(blog);
20+
const getItem = await authors.get(blog, 1);
21+
expect(typeof list).toBe('object');
22+
expect(typeof getItem).toBe('object');
23+
});
24+
test('Blog users should work', async () => {
25+
const list = await users.list(blog);
26+
const getItem = await users.get(blog, 1);
27+
expect(typeof list).toBe('object');
28+
expect(typeof getItem).toBe('object');
29+
});
30+
test('Blog articles should work', async () => {
31+
const list = await articles.list(blog);
32+
const getItem = await articles.get(blog, 1);
33+
expect(typeof list).toBe('object');
34+
expect(typeof getItem).toBe('object');
35+
});
36+
});

0 commit comments

Comments
 (0)
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