mirror of https://github.com/Kylart/KawAnime.git
Added .travis.yml
Fixed testing on default switch Fixed KawAnime dir in local.js
This commit is contained in:
parent
d2c4ab5f15
commit
a8a28c7882
|
@ -0,0 +1,10 @@
|
|||
language: node_js
|
||||
node_js:
|
||||
- "7"
|
||||
- "6"
|
||||
install:
|
||||
- npm install
|
||||
script:
|
||||
- npm run test:server
|
||||
- npm run cloc
|
||||
after_success: npm run coverage
|
|
@ -88,8 +88,11 @@ const searchLocalFiles = (url, res) => {
|
|||
++counter
|
||||
/* istanbul ignore next */
|
||||
if (counter === uniqueNames.length) {
|
||||
/* istanbul ignore next */
|
||||
// Saving new data
|
||||
fs.writeFileSync(join(userInfo().homedir, '.KawAnime', 'locals.json'), JSON.stringify(json), 'utf-8')
|
||||
process.env.NODE_ENV !== 'KawAnime-test'
|
||||
? fs.writeFileSync(join(userInfo().homedir, '.KawAnime', 'locals.json'), JSON.stringify(json), 'utf-8')
|
||||
: fs.writeFileSync(join(userInfo().homedir, '.KawAnime-test', 'locals.json'), JSON.stringify(json), 'utf-8')
|
||||
console.log('[Local] Successfully saved data.')
|
||||
|
||||
sendFiles(json, files, res)
|
||||
|
|
|
@ -177,7 +177,6 @@ const route = (nuxt) => {
|
|||
openInBrowser(process.nuxtURL, res)
|
||||
break
|
||||
|
||||
/* istanbul ignore next */
|
||||
default:
|
||||
nuxt.render(req, res)
|
||||
break
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
"license": "MIT",
|
||||
"scripts": {
|
||||
"dev": "cross-env NODE_ENV=development electron .",
|
||||
"cloc": "cloc $(git ls-files | grep -vE \".mkv|mp4\")",
|
||||
"test:server": "nyc ava --verbose --serial test/server.test.js",
|
||||
"test:front": "nightwatch",
|
||||
"test": "standard --fix && npm test:front && npm test:server",
|
||||
|
@ -102,6 +103,12 @@
|
|||
"**/*.test.js",
|
||||
"**/node_modules/**",
|
||||
"**/openExternal.js"
|
||||
]
|
||||
],
|
||||
"watermarks": {
|
||||
"lines": [80, 95],
|
||||
"functions": [80, 95],
|
||||
"branches": [80, 95],
|
||||
"statements": [80, 95]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ let server = null
|
|||
const uri = 'http://localhost:4000'
|
||||
|
||||
const DIR = join(userInfo().homedir, '.KawAnime-test')
|
||||
let kawAnimeFilesPath = {
|
||||
const kawAnimeFilesPath = {
|
||||
local: join(DIR, 'locals.json'),
|
||||
history: join(DIR, 'history.json'),
|
||||
watchList: join(DIR, 'lists.json'),
|
||||
|
@ -30,7 +30,7 @@ let kawAnimeFilesPath = {
|
|||
// Init Nuxt.js and create a server listening on localhost:4000
|
||||
test.before('Init Nuxt.js', async () => {
|
||||
/**
|
||||
* Removing potentially existing .KawAnime directory
|
||||
* Creating .KawAnime-test directory and necessary files
|
||||
*/
|
||||
const initFile = require(join(__dirname, '..', 'assets', 'scripts', 'api', 'main.js'))
|
||||
|
||||
|
@ -327,11 +327,13 @@ test('/downloader exits and render HTML', async t => {
|
|||
t.true(html.includes('Download!'))
|
||||
})
|
||||
|
||||
test('/index exits and render HTML', async t => {
|
||||
let context = {}
|
||||
const { html } = await nuxt.renderRoute('/', context)
|
||||
test('/ route exits and returns HTML (axios)', async t => {
|
||||
const { data, status } = await axios.get(`${uri}/`)
|
||||
|
||||
t.true(html.includes('少々お待ち下さいね〜'))
|
||||
t.is(status, 200)
|
||||
|
||||
t.true(data.includes('かわニメ'))
|
||||
t.true(data.includes('少々お待ち下さいね〜'))
|
||||
})
|
||||
|
||||
test('/seasons exits and render HTML', async t => {
|
||||
|
|
Loading…
Reference in New Issue