mirror of
https://github.com/bellingcat/datasheet-server.git
synced 2026-06-11 21:08:33 +03:00
amend serverProcess test to update first
This commit is contained in:
@@ -10,10 +10,9 @@ before_script:
|
|||||||
install:
|
install:
|
||||||
- yarn
|
- yarn
|
||||||
script:
|
script:
|
||||||
- if [ "TRAVIS_PULL_REQUEST" = "false" ]; then bash ./scripts/decrypt.sh; fi
|
|
||||||
- yarn build
|
- yarn build
|
||||||
- yarn lint
|
- yarn lint
|
||||||
- yarn test
|
- yarn test
|
||||||
before_install:
|
before_install:
|
||||||
- openssl aes-256-cbc -K $encrypted_eeb74e8d35d1_key -iv $encrypted_eeb74e8d35d1_iv
|
- openssl aes-256-cbc -K $encrypted_fb307c69bf51_key -iv $encrypted_fb307c69bf51_iv
|
||||||
-in .env.enc -out .env -d
|
-in .env.enc -out .env -d
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ function checkStatus (res) {
|
|||||||
|
|
||||||
/* SETUP: launch a development server with a wait time */
|
/* SETUP: launch a development server with a wait time */
|
||||||
test.before.cb(t => {
|
test.before.cb(t => {
|
||||||
console.log('launching server...')
|
console.log('SETUP: launching server and updating...')
|
||||||
serverProc = childProcess.spawn('yarn', ['dev'], {
|
serverProc = childProcess.spawn('yarn', ['dev'], {
|
||||||
cwd: '.',
|
cwd: '.',
|
||||||
stdio: 'ignore'
|
stdio: 'ignore'
|
||||||
@@ -26,7 +26,21 @@ test.before.cb(t => {
|
|||||||
serverExited = true
|
serverExited = true
|
||||||
})
|
})
|
||||||
|
|
||||||
setTimeout(t.end, SERVER_LAUNCH_WAIT_TIME)
|
function pingUpdate () {
|
||||||
|
const expected = {
|
||||||
|
success: 'All sheets updated'
|
||||||
|
}
|
||||||
|
|
||||||
|
return fetch(`${SERVER_ROOT}/api/update`)
|
||||||
|
.then(checkStatus)
|
||||||
|
.then(res => res.json())
|
||||||
|
.then(json => {
|
||||||
|
t.deepEqual(json, expected)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
setTimeout(pingUpdate, SERVER_LAUNCH_WAIT_TIME)
|
||||||
})
|
})
|
||||||
|
|
||||||
/* CLEANUP: kill the server */
|
/* CLEANUP: kill the server */
|
||||||
@@ -39,19 +53,6 @@ test('should launch', t => {
|
|||||||
t.false(serverExited)
|
t.false(serverExited)
|
||||||
})
|
})
|
||||||
|
|
||||||
test('should update', t => {
|
|
||||||
const expected = {
|
|
||||||
success: 'All sheets updated'
|
|
||||||
}
|
|
||||||
|
|
||||||
return fetch(`${SERVER_ROOT}/api/update`)
|
|
||||||
.then(checkStatus)
|
|
||||||
.then(res => res.json())
|
|
||||||
.then(json => {
|
|
||||||
t.deepEqual(json, expected)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
const passUrls = [
|
const passUrls = [
|
||||||
// /
|
// /
|
||||||
'/api/',
|
'/api/',
|
||||||
|
|||||||
Reference in New Issue
Block a user