Skip to content

Commit

Permalink
fix travis mysql setup
Browse files Browse the repository at this point in the history
  • Loading branch information
ponury-kostek committed Jul 16, 2018
1 parent cecbc46 commit da862e0
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 23 deletions.
10 changes: 8 additions & 2 deletions .travis.yml
Expand Up @@ -4,10 +4,16 @@ addons:
- mysql-5.7-trusty
packages:
- mysql-server
- mysql-client

before_install:
- sudo mysql -e "use mysql; update user set authentication_string=PASSWORD('root') where User='root'; update user set plugin='mysql_native_password';FLUSH PRIVILEGES;"
- sudo mysql_upgrade -u root --password="root"
- sudo service mysql restart
- mysql -u root --password="root" < test/travis.sql

before_script:
- mysql -e 'create database antvel_testing;'
language: node_js

node_js:
- 8
- 9
Expand Down
31 changes: 21 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 5 additions & 6 deletions package.json
Expand Up @@ -20,7 +20,8 @@
"node": ">=8.0.0"
},
"peerDependencies": {
"amule": "^0.2.4"
"amule": "^0.2.4",
"mysql": "^2.15.0"
},
"devDependencies": {
"amule": "^0.2.4",
Expand All @@ -30,7 +31,8 @@
"istanbul": "^0.4.5",
"jsdoc": "^3.5.5",
"mocha": "^5.2.0",
"mocha-lcov-reporter": "^1.3.0"
"mocha-lcov-reporter": "^1.3.0",
"mysql": "^2.15.0"
},
"repository": {
"type": "git",
Expand All @@ -39,8 +41,5 @@
"bugs": {
"url": "https://github.com/alexandrajs/amule-myro/issues"
},
"homepage": "https://github.com/alexandrajs/amule-myro#readme",
"dependencies": {
"mysql": "github:mysqljs/mysql"
}
"homepage": "https://github.com/alexandrajs/amule-myro#readme"
}
24 changes: 19 additions & 5 deletions test/base.js
Expand Up @@ -7,15 +7,14 @@ const AMule = require("amule");
const Myro = require("../");
const assert = require("assert");
const mysql = require("mysql");
let client;
describe("CRUD", () => {
let connection;
before((done) => {
connection = mysql.createConnection({
host: "192.168.0.200",
host: "localhost",
user: "root",
password: "root",
database: "ponury"
database: "test"
});
connection.connect(done);
});
Expand All @@ -24,7 +23,12 @@ describe("CRUD", () => {
});
beforeEach((done) => {
connection.query("TRUNCATE `tbl`", (err) => {
done(err);
if (err) {
return done(err);
}
connection.query("TRUNCATE `tbl_json`", (err) => {
done(err);
});
});
});
it("has", (done) => {
Expand Down Expand Up @@ -77,7 +81,17 @@ describe("CRUD", () => {
});
it("get json type", (done) => {
let mule = new AMule();
const json = {a:1,b:true,c:null,d:[1,2.3,4,{}]};
const json = {
a: 1,
b: true,
c: null,
d: [
1,
2.3,
4,
{}
]
};
mule.use(new Myro(connection));
mule.has("tbl_json", 42, function (err, has) {
assert.strictEqual(err, null);
Expand Down
8 changes: 8 additions & 0 deletions test/travis.sql
@@ -0,0 +1,8 @@
# Create DB
CREATE DATABASE IF NOT EXISTS `test` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;

USE `test`;

# Create Table
CREATE TABLE `tbl` (`id` int(10) unsigned NOT NULL AUTO_INCREMENT, `value` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB;
CREATE TABLE `tbl_json` (`id` int(10) unsigned NOT NULL AUTO_INCREMENT, `value` json DEFAULT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB;

0 comments on commit da862e0

Please sign in to comment.