Skip to content

Commit a0cf3fc

Browse files
authored
Merge pull request #4 from saddamarbaa/refactor/migrate-to-typeScript
refactor: migrate to typescript and add api docs
2 parents 1e153af + fb3e17e commit a0cf3fc

File tree

125 files changed

+26439
-6913
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+26439
-6913
lines changed

.gitignore

Lines changed: 76 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,77 @@
1-
node_modules
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
27

3-
.env
8+
# Runtime data
9+
pids
10+
*.pid
11+
*.seed
12+
*.pid.lock
13+
14+
# Directory for instrumented libs generated by jscoverage/JSCover
15+
lib-cov
16+
17+
# Coverage directory used by tools like istanbul
18+
coverage
19+
20+
# nyc test coverage
21+
.nyc_output
22+
23+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
24+
.grunt
25+
26+
# Bower dependency directory (https://bower.io/)
27+
bower_components
28+
29+
# node-waf configuration
30+
.lock-wscript
31+
32+
# Compiled binary addons (https://nodejs.org/api/addons.html)
33+
build/Release
34+
35+
# Dependency directories
36+
node_modules/
37+
jspm_packages/
38+
39+
# TypeScript v1 declaration files
40+
typings/
41+
42+
# Optional npm cache directory
43+
.npm
44+
45+
# Optional eslint cache
46+
.eslintcache
47+
48+
# Optional REPL history
49+
.node_repl_history
50+
51+
# Output of 'npm pack'
52+
*.tgz
53+
54+
# Yarn Integrity file
55+
.yarn-integrity
56+
57+
# dotenv environment variables file
58+
.env
59+
60+
# parcel-bundler cache (https://parceljs.org/)
61+
.cache
62+
63+
# next.js build output
64+
.next
65+
66+
# nuxt.js build output
67+
.nuxt
68+
69+
# vuepress build output
70+
.vuepress/dist
71+
72+
# Serverless directories
73+
.serverless
74+
75+
dist
76+
77+
.DS_Store

__mocks__/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
// @ts-ignore
3+
// Todo mocking test

__tests__/api.test.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import request from 'supertest';
2+
3+
import app from '@src/app';
4+
5+
describe('GET /api/v1', () => {
6+
it('responds with a json message', (done) => {
7+
request(app).get('/api/v1').set('Accept', 'application/json').expect('Content-Type', /json/).expect(
8+
200,
9+
{
10+
message: 'API - 👋🌎🌍🌏',
11+
},
12+
done
13+
);
14+
});
15+
});
16+
17+
describe('GET /api/v1/emojis', () => {
18+
it('responds with a json message', (done) => {
19+
request(app)
20+
.get('/api/v1/emojis')
21+
.set('Accept', 'application/json')
22+
.expect('Content-Type', /json/)
23+
.expect(200, ['😀', '😳', '🙄'], done);
24+
});
25+
});

__tests__/app.test.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import request from 'supertest';
2+
3+
import app from '@src/app';
4+
5+
describe('app', () => {
6+
it('responds with a not found message', (done) => {
7+
request(app)
8+
.get('/what-is-this-even')
9+
.set('Accept', 'application/json')
10+
.expect('Content-Type', /json/)
11+
.expect(404, done);
12+
});
13+
});
14+
15+
describe('GET /', () => {
16+
it('responds with a json message', (done) => {
17+
request(app).get('/').set('Accept', 'application/json').expect('Content-Type', /json/).expect(
18+
200,
19+
{
20+
message: '🦄🌈✨👋🌎🌍🌏✨🌈🦄',
21+
},
22+
done
23+
);
24+
});
25+
});

__tests__/e2e/posts.spec.js

Lines changed: 0 additions & 67 deletions
This file was deleted.

__tests__/math/math.js

Lines changed: 0 additions & 9 deletions
This file was deleted.

__tests__/math/math.test.js

Lines changed: 0 additions & 36 deletions
This file was deleted.

__tests__/test.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

app.js

Lines changed: 0 additions & 80 deletions
This file was deleted.

0 commit comments

Comments
 (0)