-
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.
update travis w/new Database tests, will update tests to include old …
…overhauled tests ref #10
- Loading branch information
1 parent
b3c1743
commit 41a6aac
Showing
16 changed files
with
872 additions
and
523 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 |
---|---|---|
@@ -1 +1,2 @@ | ||
./node_modules | ||
node_modules/ | ||
testData/ |
This file was deleted.
Oops, something went wrong.
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,10 +1,14 @@ | ||
sudo: required | ||
|
||
env: | ||
- SPATIALITE_LOCATION=/usr/lib/x86_64-linux/gnu/mod_spatialite.so.7 | ||
- ENVIRONMENT=test | ||
|
||
services: | ||
- docker | ||
|
||
before_install: | ||
- docker build -t posm-paths . | ||
- npm run clean-migrations && docker build -t posm-paths . | ||
|
||
script: | ||
- docker run posm-paths /bin/bash -c 'echo "UNIT TESTS GO HERE"' | ||
- docker run posm-paths /bin/bash -c 'npm install --build-from-sources && SPATIALITE_LOCATION=/usr/lib/x86_64-linux-gnu ENVIRONMENT=test npm run test:migrate' |
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,16 +1,34 @@ | ||
FROM ubuntu:14.04 | ||
FROM ubuntu:16.04 | ||
|
||
RUN mkdir /home/posm-paths | ||
COPY ./ /home/posm-paths/ | ||
|
||
# nvm help -> https://gist.github.com/remarkablemark/aacf14c29b3f01d6900d13137b21db3a | ||
# replace shell with bash so we can source files | ||
RUN rm /bin/sh && ln -s /bin/bash /bin/sh | ||
|
||
# --- get curl and deps for building node. --- # | ||
# update the repository sources list | ||
# and install dependencies | ||
RUN apt-get update \ | ||
&& apt-get install -yq curl \ | ||
build-essential \ | ||
sqlite3 \ | ||
libsqlite3-dev \ | ||
libspatialite-dev \ | ||
|
||
# -- specific node version -- # | ||
RUN curl -sL https://deb.nodesource.com/setup_10.x \ | ||
&& apt-get install nodejs | ||
&& apt-get install -y curl python make g++ libsqlite3-mod-spatialite \ | ||
&& apt-get -y autoclean | ||
|
||
# nvm environment variables | ||
ENV NVM_DIR /usr/local/nvm | ||
ENV NODE_VERSION 10.7.0 | ||
|
||
# install nvm | ||
# https://github.com/creationix/nvm#install-script | ||
RUN curl --silent -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.2/install.sh | bash | ||
|
||
# install node and npm | ||
RUN source $NVM_DIR/nvm.sh \ | ||
&& nvm install $NODE_VERSION \ | ||
&& nvm alias default $NODE_VERSION \ | ||
&& nvm use default | ||
|
||
# add node and npm to path so the commands are available | ||
ENV NODE_PATH $NVM_DIR/v$NODE_VERSION/lib/node_modules | ||
ENV PATH $NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH | ||
|
||
WORKDIR /home/posm-paths |
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 |
---|---|---|
@@ -1,22 +1,30 @@ | ||
'use strict' | ||
'use strict'; | ||
|
||
const dbLoc = require('../../config')[process.env.ENVIRONMENT || 'test'].db; | ||
const Database = require('../'); | ||
|
||
const fs = require('fs'); | ||
const path = require('path'); | ||
const upSQL = fs.readFileSync(path.join(__dirname, '..', 'sql', '1533377087768-add-users-up.sql')).toString(); | ||
const downSQL = fs.readFileSync(path.join(__dirname, '..', 'sql', '1533377087768-add-users-down.sql')).toString(); | ||
const readFile = require('fs-extra').readFile | ||
|
||
const up = path.join(__dirname, '..', 'sql', '1533377087768-add-users-up.sql') | ||
const down = path.join(__dirname, '..', 'sql', '1533377087768-add-users-down.sql') | ||
|
||
const dbLoc = require('../../config')[process.env.ENVIRONMENT || 'develop'].db; | ||
const Database = require('../'); | ||
Database.connect(dbLoc); | ||
|
||
module.exports.up = function (next) { | ||
Database.execute(upSQL) | ||
.then(() => next()) | ||
.catch(error => { console.error(error); next(); }); | ||
exports.up = (next) => { | ||
readFile(up).then(sql => { | ||
Database | ||
.execute(sql.toString()) | ||
.then(() => next()) | ||
.catch((err) => { throw err; }); | ||
}); | ||
}; | ||
|
||
module.exports.down = function (next) { | ||
Database.execute(downSQL) | ||
.then(() => next()) | ||
.catch(error => { console.error(error); next(); }); | ||
}; | ||
exports.down = (next) => { | ||
readFile(down).then(sql => { | ||
Database | ||
.execute(sql.toString()) | ||
.then(() => next()) | ||
.catch((err) => { throw err; }) | ||
}) | ||
} |
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,30 @@ | ||
'use strict' | ||
'use strict'; | ||
|
||
const dbLoc = require('../../config')[process.env.ENVIRONMENT || 'test'].db; | ||
const Database = require('../'); | ||
|
||
const fs = require('fs'); | ||
const path = require('path'); | ||
const upSQL = fs.readFileSync(path.join(__dirname, '..', 'sql', '1533377095426-add-sequences-up.sql')).toString(); | ||
const downSQL = fs.readFileSync(path.join(__dirname, '..', 'sql', '1533377095426-add-sequences-down.sql')).toString(); | ||
const readFile = require('fs-extra').readFile; | ||
|
||
const up = path.join(__dirname, '..', 'sql', '1533377095426-add-sequences-up.sql') | ||
const down = path.join(__dirname, '..', 'sql', '1533377095426-add-sequences-down.sql') | ||
|
||
const dbLoc = require('../../config')[process.env.ENVIRONMENT || 'develop'].db; | ||
const Database = require('../'); | ||
Database.connect(dbLoc); | ||
|
||
module.exports.up = function (next) { | ||
Database.execute(upSQL) | ||
.then(() => next()) | ||
.catch(error => { console.error(error); next(); }) | ||
exports.up = (next) => { | ||
readFile(up).then(sql => { | ||
Database | ||
.execute(sql.toString()) | ||
.then(() => next()) | ||
.catch((err) => { throw err; }) | ||
}) | ||
} | ||
|
||
module.exports.down = function (next) { | ||
Database.execute(downSQL) | ||
.then(() => next()) | ||
.catch(error => { console.error(error); next(); }) | ||
} | ||
exports.down = (next) => { | ||
readFile(down).then(sql => { | ||
Database | ||
.execute(sql.toString()) | ||
.then(() => next()) | ||
.catch((err) => { throw err; }) | ||
}) | ||
} |
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,30 @@ | ||
'use strict' | ||
'use strict'; | ||
|
||
const dbLoc = require('../../config')[process.env.ENVIRONMENT || 'test'].db; | ||
const Database = require('../'); | ||
|
||
const fs = require('fs'); | ||
const path = require('path'); | ||
const upSQL = fs.readFileSync(path.join(__dirname, '..', 'sql', '1533377102405-add-images-up.sql')).toString(); | ||
const downSQL = fs.readFileSync(path.join(__dirname, '..', 'sql', '1533377102405-add-images-down.sql')).toString(); | ||
const readFile = require('fs-extra').readFile; | ||
|
||
const up = path.join(__dirname, '..', 'sql', '1533377102405-add-images-up.sql') | ||
const down = path.join(__dirname, '..', 'sql', '1533377102405-add-images-down.sql') | ||
|
||
const dbLoc = require('../../config')[process.env.ENVIRONMENT || 'develop'].db; | ||
const Database = require('../'); | ||
Database.connect(dbLoc); | ||
|
||
module.exports.up = function (next) { | ||
Database.executeSpatial(upSQL) | ||
.then(() => next()) | ||
.catch(error => { console.error(error); next(); }) | ||
exports.up = (next) => { | ||
readFile(up).then(sql => { | ||
Database | ||
.executeSpatial(sql.toString()) | ||
.then(() => next()) | ||
.catch((err) => { throw err; }) | ||
}) | ||
} | ||
|
||
module.exports.down = function (next) { | ||
Database.executeSpatial(downSQL) | ||
.then(() => next()) | ||
.catch(error => { console.error(error); next(); }); | ||
} | ||
exports.down = (next) => { | ||
readFile(down).then(sql => { | ||
Database | ||
.executeSpatial(sql.toString()) | ||
.then(() => next()) | ||
.catch((err) => { throw err; }); | ||
}) | ||
} |
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
File renamed without changes.
Oops, something went wrong.