-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Relates to #34
- Loading branch information
Nicos
committed
Apr 20, 2018
1 parent
ecdcd3f
commit e4eaa0e
Showing
2 changed files
with
115 additions
and
12 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,86 @@ | ||
const test = require('tape'); | ||
const request = require('supertest'); | ||
const app = require('../app'); | ||
const runDbBuild = require('/home/nicos/FAC13/crypt-os/src/model/database/db_build.js'); | ||
const getAllCoins = require('../model/queries/get_all_coins.js'); | ||
const getCoin = require('../model/queries/get_coin_details.js'); | ||
|
||
test('Test tape is running', t => { | ||
request(app) | ||
.get('/') | ||
.expect(200) | ||
.end((err, res) => { | ||
t.equal(1, 1, 'Tape is running'); | ||
t.end(); | ||
}); | ||
}); | ||
|
||
test('Test status code of landing page', t => { | ||
request(app) | ||
.get('/') | ||
.expect(200) | ||
.expect('Content-Type', /html/) | ||
.end((err, res) => { | ||
t.error(err); | ||
t.equal(res.statusCode, 200, 'Returns status 200'); | ||
t.end(); | ||
}); | ||
}); | ||
|
||
test('Test status code for valid coin symbol', t => { | ||
request(app) | ||
.get('/btc') | ||
.expect(200) | ||
.expect('Content-Type', /html/) | ||
.end((err, res) => { | ||
t.error(err); | ||
t.equal(res.statusCode, 200, 'Returns status 200'); | ||
t.end(); | ||
}); | ||
}); | ||
|
||
test('Test status for error 404', t => { | ||
request(app) | ||
.get('/blah') | ||
.expect(404) | ||
.expect('Content-Type', /html/) | ||
.end((err, res) => { | ||
t.error(err); | ||
t.equal(res.statusCode, 404, 'Returns error 404'); | ||
t.end(); | ||
}); | ||
}); | ||
|
||
test('Test for the first row of all coins query', t => { | ||
const expected = { name: 'Bitcoin', symbol: 'btc' }; | ||
runDbBuild((err, res) => { | ||
getAllCoins().then(res => { | ||
t.deepEqual( | ||
res[0], | ||
expected, | ||
'getAllCoins return the first row of the coins table' | ||
); | ||
t.end(); | ||
}); | ||
}); | ||
}); | ||
|
||
test('Test for getting the details of one coin', t => { | ||
const expected = { | ||
id: '1', | ||
name: 'Bitcoin', | ||
symbol: 'btc', | ||
rank: 1, | ||
supply: '21000000.0' | ||
}; | ||
runDbBuild((err, res) => { | ||
getCoin('btc').then(res => { | ||
t.deepEqual( | ||
res[0], | ||
expected, | ||
'getCoin returns all database details of Bitcoin' | ||
); | ||
t.end(); | ||
}); | ||
}); | ||
}); |
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 |
---|---|---|
@@ -1,22 +1,39 @@ | ||
<section class="section__banner"> | ||
|
||
<h1 class="header">Choose a coin to find more info:</h1> | ||
<h2 class="header">In a ludicrous world of digital currencies...</h2> | ||
<p class="header__desc">Don't believe us? Simply click below of to see details of the top 10 cryptocurrencies in the world right now:</p> | ||
|
||
<div class="section__coins"> | ||
<div class="coins__list"> | ||
<div class="section__coins"> | ||
<div class="coins__list"> | ||
|
||
{{#each allCoins}} | ||
{{#each allCoins}} | ||
|
||
<div class="coin__list--item"> | ||
<a href="/{{this.symbol}}"> | ||
{{!-- <div class="coin__logo" style="background-image: url(/images/coins/{{ this.symbol }}.svg)"></div> --}} | ||
<img src="/images/coins/{{ this.symbol }}.svg"/> | ||
</a> | ||
</div> | ||
<div class="coin__list--item"> | ||
<a href="/{{this.symbol}}"> | ||
{{!-- | ||
<div class="coin__logo" style="background-image: url(/images/coins/{{ this.symbol }}.svg)"></div> --}} | ||
<img src="/images/coins/{{ this.symbol }}.svg" /> | ||
</a> | ||
</div> | ||
|
||
|
||
{{/each}} | ||
{{/each}} | ||
|
||
</div> | ||
</div> | ||
</div> | ||
</section> | ||
|
||
<h2>A team of boy-band coders called Crypt-OS have decided to make a difference</h2> | ||
|
||
<div class="avatars__list"> | ||
<img class="avatar" src="/images/avatars/1.svg" /> | ||
<img class="avatar" src="/images/avatars/2.svg" /> | ||
<img class="avatar" src="/images/avatars/3.svg" /> | ||
<img class="avatar" src="/images/avatars/4.svg" /> | ||
</div> | ||
|
||
|
||
<section> | ||
|
||
|
||
</section> |