-
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.
- Loading branch information
Kârūn The Rich
committed
May 22, 2024
1 parent
715a90d
commit 20879e4
Showing
9 changed files
with
95 additions
and
29 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
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,39 @@ | ||
import request from 'supertest'; | ||
import app from '../app'; | ||
|
||
describe('GET /', () => { | ||
let get: request.Test; | ||
beforeEach(() => { | ||
get = request(app).get('/'); | ||
}); | ||
it('should return w/an HTTP code = 302 Found', async () => { | ||
await get.expect(302); | ||
}); | ||
}); | ||
describe('GET /*/manifest.json', () => { | ||
let get: request.Test; | ||
beforeEach(() => { | ||
get = request(app).get('/home/manifest.json'); | ||
}); | ||
it('should return w/an HTTP code = 302 Found', async () => { | ||
await get.expect(302); | ||
}); | ||
}); | ||
describe('GET /home', () => { | ||
let get: request.Test; | ||
beforeEach(() => { | ||
get = request(app).get('/home'); | ||
}); | ||
it('should return w/an HTTP code = 200 OK', async () => { | ||
await get.expect(200); | ||
}); | ||
it('should return w/a Content-Type ~ html', async () => { | ||
await get.expect('Content-Type', /html/) | ||
}); | ||
it('should return w/a Content-Length > 0', async () => { | ||
await get.expect((res) => { | ||
const length = BigInt(res.headers['content-length']); | ||
expect(length).toBeGreaterThan(0); | ||
}); | ||
}); | ||
}); |
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,20 @@ | ||
import { Router } from 'express'; | ||
import { env_of } from './functions'; | ||
const router = Router(); | ||
|
||
/** REDIRECT to manifest.json. */ | ||
router.get(/\/[^/]+\/manifest\.json$/, (req, res) => { | ||
res.redirect('/manifest.json'); | ||
}); | ||
/** REDIRECT to home page. */ | ||
router.get('/', (req, res) => { | ||
res.redirect('/home'); | ||
}); | ||
/** GET home page. */ | ||
router.get('/home', (req, res) => { | ||
res.render('home/home.pig', { | ||
DESCRIPTION: 'Mine & Mint Proof-of-Work XPower Tokens', | ||
TITLE: 'XPower', ...env_of(req), | ||
}); | ||
}); | ||
export default router; |
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
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
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,13 @@ | ||
extends ../app.pug | ||
|
||
block styles | ||
include ../theme/theme.pug | ||
|
||
block header | ||
include ../header/header.pug | ||
|
||
block content | ||
content | ||
|
||
block footer | ||
include ../footer/footer.pug |
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 @@ | ||
@import "../app.scss"; |
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 @@ | ||
import './home.scss'; |
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