Skip to content

Commit

Permalink
Fix for invalid old node 0.10 syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
dcrockwell committed Jan 4, 2017
1 parent dec7701 commit 076741a
Show file tree
Hide file tree
Showing 8 changed files with 232 additions and 31 deletions.
1 change: 0 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@
"space-return-throw-case": 2,
"space-unary-ops": [2, { "words": true, "nonwords": false }],
"spaced-line-comment": [0, "always"],
"strict": 2,
"use-isnan": 2,
"valid-jsdoc": 0,
"valid-typeof": 2,
Expand Down
200 changes: 200 additions & 0 deletions count.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
## Dovima


```chart
{
"type": "line",
"options": {
"title": {
"display": true,
"text": "Dovima"
}
},
"data": {
"labels": [
"invalidAttributes.js:0",
"index.spec.js:4",
"destroy.js:5",
"softDelete.js:6",
"softDestroy.js:7",
"destroy.spec.js:8",
"mock.delete.spec.js:10",
"find.orWhere.spec.js:11",
"mock.save.spec.js:12",
"find.limit.spec.js:13",
"symbols.js:14",
"useSoftDelete.spec.js:16",
"options.database.spec.js:17",
"softDelete.spec.js:18",
"areOnlyProperties.spec.js:19",
"find.whereNull.spec.js:20",
"find.orderBy.spec.js:23",
"softDestroy.spec.js:24",
"equalTo.spec.js:26",
"afterSave.spec.js:28",
"mock.spec.js:29",
"testClasses.js:31",
"delete.spec.js:37",
"delete.js:46",
"mock.instance.spec.js:47",
"collection.js:62",
"isPresent.js:66",
"find.spec.js:71",
"save.js:77",
"addAssociation.js:96",
"isPresent.spec.js:123",
"fetch.spec.js:139",
"fetch.js:150",
"save.spec.js:163",
"index.js:185",
"modelFinder.js:225",
"model.spec.js:544"
],
"datasets": [
{
"label": "Cyclomatic Complexity",
"fill": true,
"borderColor": "#f484d3",
"data": [
1,
1,
2,
1,
2,
1,
1,
1,
1,
1,
1,
1.75,
1,
1,
1,
1,
1,
3,
1,
2,
2.6666666666666665,
1,
1,
10,
4,
15,
16,
1,
14,
16,
1,
1,
29,
1,
28,
42,
1
]
}
]
}
}
```

```chart
{
"type": "line",
"options": {
"title": {
"display": true,
"text": "Dovima"
}
},
"data": {
"labels": [
"invalidAttributes.js:0",
"index.spec.js:4",
"destroy.js:5",
"softDelete.js:6",
"softDestroy.js:7",
"destroy.spec.js:8",
"mock.delete.spec.js:10",
"find.orWhere.spec.js:11",
"mock.save.spec.js:12",
"find.limit.spec.js:13",
"symbols.js:14",
"useSoftDelete.spec.js:16",
"options.database.spec.js:17",
"softDelete.spec.js:18",
"areOnlyProperties.spec.js:19",
"find.whereNull.spec.js:20",
"find.orderBy.spec.js:23",
"softDestroy.spec.js:24",
"equalTo.spec.js:26",
"afterSave.spec.js:28",
"mock.spec.js:29",
"testClasses.js:31",
"delete.spec.js:37",
"delete.js:46",
"mock.instance.spec.js:47",
"collection.js:62",
"isPresent.js:66",
"find.spec.js:71",
"save.js:77",
"addAssociation.js:96",
"isPresent.spec.js:123",
"fetch.spec.js:139",
"fetch.js:150",
"save.spec.js:163",
"index.js:185",
"modelFinder.js:225",
"model.spec.js:544"
],
"datasets": [
{
"label": "Halstead Time (Minutes)",
"fill": true,
"borderColor": "#ab5cf9",
"data": [
0,
0.6221666666666666,
0.7644833333333333,
1.69105,
1.6055166666666667,
1.5173666666666668,
1.7241416666666667,
2.931166666666667,
2.7480166666666666,
4.3081,
1.0142,
5.824354166666667,
5.51345,
11.775316666666667,
6.704566666666667,
7.831433333333334,
10.867750000000001,
10.162866666666668,
16.747433333333333,
8.050033333333333,
14.855311111111112,
18.632358333333332,
39.658633333333334,
38.98015,
27.58536666666667,
84.56638333333333,
56.067699999999995,
46.87863333333333,
81.66416666666667,
172.13055,
123.73876666666666,
119.74196666666667,
443.61873333333335,
123.20309999999999,
580.4338166666668,
791.7049833333333,
957.0403833333334
]
}
]
}
}
```
2 changes: 2 additions & 0 deletions dovima-count.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<!DOCTYPE html><html><head><meta charset="utf-8"><title>Markdown Plus exported HTML</title><link rel="stylesheet" href="https://cdn.rawgit.com/tylingsoft/markdown-core/0.7.0/dist/markdown-core.min.css"></head><body><article class="markdown-body"><iframe class="chartjs-hidden-iframe" tabindex="-1" style="width: 100%; display: block; border: 0px; height: 0px; margin: 0px; position: absolute; left: 0px; right: 0px; top: 0px; bottom: 0px;"></iframe><iframe class="chartjs-hidden-iframe" tabindex="-1" style="width: 100%; display: block; border: 0px; height: 0px; margin: 0px; position: absolute; left: 0px; right: 0px; top: 0px; bottom: 0px;"></iframe><h2 id="dovima"><a class="anchor" href="#dovima"><span class="octicon octicon-link"></span></a>Dovima</h2>
<canvas class="chartjs" width="948" height="474" style="display: block; width: 948px; height: 474px;">{"type":"line","options":{"title":{"display":true,"text":"Dovima"}},"data":{"labels":["invalidAttributes.js:0","index.spec.js:4","destroy.js:5","softDelete.js:6","softDestroy.js:7","destroy.spec.js:8","mock.delete.spec.js:10","find.orWhere.spec.js:11","mock.save.spec.js:12","find.limit.spec.js:13","symbols.js:14","useSoftDelete.spec.js:16","options.database.spec.js:17","softDelete.spec.js:18","areOnlyProperties.spec.js:19","find.whereNull.spec.js:20","find.orderBy.spec.js:23","softDestroy.spec.js:24","equalTo.spec.js:26","afterSave.spec.js:28","mock.spec.js:29","testClasses.js:31","delete.spec.js:37","delete.js:46","mock.instance.spec.js:47","collection.js:62","isPresent.js:66","find.spec.js:71","save.js:77","addAssociation.js:96","isPresent.spec.js:123","fetch.spec.js:139","fetch.js:150","save.spec.js:163","index.js:185","modelFinder.js:225","model.spec.js:544"],"datasets":[{"label":"Cyclomatic Complexity","fill":true,"borderColor":"#f484d3","data":[1,1,2,1,2,1,1,1,1,1,1,1.75,1,1,1,1,1,3,1,2,2.6666666666666665,1,1,10,4,15,16,1,14,16,1,1,29,1,28,42,1]}]}}</canvas><canvas class="chartjs" width="948" height="474" style="display: block; width: 948px; height: 474px;">{"type":"line","options":{"title":{"display":true,"text":"Dovima"}},"data":{"labels":["invalidAttributes.js:0","index.spec.js:4","destroy.js:5","softDelete.js:6","softDestroy.js:7","destroy.spec.js:8","mock.delete.spec.js:10","find.orWhere.spec.js:11","mock.save.spec.js:12","find.limit.spec.js:13","symbols.js:14","useSoftDelete.spec.js:16","options.database.spec.js:17","softDelete.spec.js:18","areOnlyProperties.spec.js:19","find.whereNull.spec.js:20","find.orderBy.spec.js:23","softDestroy.spec.js:24","equalTo.spec.js:26","afterSave.spec.js:28","mock.spec.js:29","testClasses.js:31","delete.spec.js:37","delete.js:46","mock.instance.spec.js:47","collection.js:62","isPresent.js:66","find.spec.js:71","save.js:77","addAssociation.js:96","isPresent.spec.js:123","fetch.spec.js:139","fetch.js:150","save.spec.js:163","index.js:185","modelFinder.js:225","model.spec.js:544"],"datasets":[{"label":"Halstead Time (Minutes)","fill":true,"borderColor":"#ab5cf9","data":[0,0.6221666666666666,0.7644833333333333,1.69105,1.6055166666666667,1.5173666666666668,1.7241416666666667,2.931166666666667,2.7480166666666666,4.3081,1.0142,5.824354166666667,5.51345,11.775316666666667,6.704566666666667,7.831433333333334,10.867750000000001,10.162866666666668,16.747433333333333,8.050033333333333,14.855311111111112,18.632358333333332,39.658633333333334,38.98015,27.58536666666667,84.56638333333333,56.067699999999995,46.87863333333333,81.66416666666667,172.13055,123.73876666666666,119.74196666666667,443.61873333333335,123.20309999999999,580.4338166666668,791.7049833333333,957.0403833333334]}]}}</canvas></article><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.slim.min.js"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.2.2/Chart.bundle.min.js"></script><script>$(function() { $('canvas.chartjs').each(function() { new Chart($(this), JSON.parse($(this).text())); }); });</script></body></html>
16 changes: 8 additions & 8 deletions es6/spec/model.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,9 +336,9 @@ describe("Model(attributes, options)", () => {
});

it("should throw an error", () => {
() => {
(() => {
wheel.truck = truck;
}.should.throw("Neither \"wheel\" or \"wheels\" are valid associations on \"Truck\"");
}).should.throw("Neither \"wheel\" or \"wheels\" are valid associations on \"Truck\"");
});
});

Expand Down Expand Up @@ -784,9 +784,9 @@ describe("Model(attributes, options)", () => {
"select * from `users` where `id` = 1 limit 1":
[userAttributes]
});
() => {
(() => {
user.include("bogusAssociation").fetch();
}.should.throw("Cannot fetch 'bogusAssociation' because it is not a valid association on User");
}).should.throw("Cannot fetch 'bogusAssociation' because it is not a valid association on User");
});

it("should throw an error if a belongs to association id is not set", () => {
Expand All @@ -795,10 +795,10 @@ describe("Model(attributes, options)", () => {
[{id: 1}]
});

() => {
(() => {
comment.id = 1;
comment.include("photo").fetch();
}.should.throw("Cannot fetch 'photo' because 'photoId' is not set on Comment");
}).should.throw("Cannot fetch 'photo' because 'photoId' is not set on Comment");
});

it("should return the model to support chaining", () => {
Expand Down Expand Up @@ -912,14 +912,14 @@ describe("Model(attributes, options)", () => {

class Post {} // Needed to mock a through association that is incomplete

() => {
(() => {
user.hasMany("posts", Post)
.through("photos");

user
.include("posts")
.fetch();
}.should.throw("'posts' is not a valid association on through model 'Photo'");
}).should.throw("'posts' is not a valid association on through model 'Photo'");
});

it("should fetch hasMany through hasOne associations", done => {
Expand Down
24 changes: 12 additions & 12 deletions es6/spec/model/fetch.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ describe(".fetch(callback)", () => {
});

it("should throw an error", () => {
() => {
(() => {
user.fetch();
}.should.throw("Cannot fetch this model by the 'id' field because it is not set.");
}).should.throw("Cannot fetch this model by the 'id' field because it is not set.");
});
});

Expand Down Expand Up @@ -101,9 +101,9 @@ describe(".fetch(callback)", () => {
});

it("should throw an error", () => {
() => {
(() => {
user.fetch();
}.should.throw("Cannot fetch without Model.database set.");
}).should.throw("Cannot fetch without Model.database set.");
});
});

Expand Down Expand Up @@ -143,9 +143,9 @@ describe(".fetch(callback)", () => {
});

it("should throw an error", () => {
() => {
(() => {
user.fetch("name");
}.should.throw("Cannot fetch this model by the 'name' field because it is not set.");
}).should.throw("Cannot fetch this model by the 'name' field because it is not set.");
});
});

Expand Down Expand Up @@ -174,9 +174,9 @@ describe(".fetch(callback)", () => {
});

it("should throw an error", () => {
() => {
(() => {
user.fetch("name");
}.should.throw("Cannot fetch without Model.database set.");
}).should.throw("Cannot fetch without Model.database set.");
});
});
});
Expand Down Expand Up @@ -219,9 +219,9 @@ describe(".fetch(callback)", () => {
});

it("should throw an error", () => {
() => {
(() => {
user.fetch(["name", "lastName"]);
}.should.throw("Cannot fetch this model by the 'lastName' field because it is not set.");
}).should.throw("Cannot fetch this model by the 'lastName' field because it is not set.");
});
});

Expand Down Expand Up @@ -251,9 +251,9 @@ describe(".fetch(callback)", () => {
});

it("should throw an error", () => {
() => {
(() => {
user.fetch("name");
}.should.throw("Cannot fetch without Model.database set.");
}).should.throw("Cannot fetch without Model.database set.");
});
});
});
Expand Down
4 changes: 2 additions & 2 deletions es6/spec/model/mock.delete.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ describe(".mock.delete()", () => {
});

it("should mock delete callback", done => {
() => {
(() => {
user.delete(() => {
done();
});
}.should.not.throw();
}).should.not.throw();
});
});
8 changes: 4 additions & 4 deletions es6/spec/model/mock.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ describe(".mock", () => {
});

it("should not affect calls with different parameters", () => {
() => {
(() => {
User.find.one.where("id", 2).results(() => {});
}.should.throw("Cannot find models without a database set.");
}).should.throw("Cannot find models without a database set.");
});

it("should not affect calls with a different chain", () => {
() => {
(() => {
User.find.all.where("id", 1).results(() => {});
}.should.throw("Cannot find models without a database set.");
}).should.throw("Cannot find models without a database set.");
});
});
8 changes: 4 additions & 4 deletions es6/spec/model/save.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,15 +152,15 @@ describe("Model(attributes, options)", () => {
});

it("should throw when assign a non model object to a belongsTo association", () => {
() => {
(() => {
steeringWheel.truck = {};
}.should.throw("Cannot set a non model entity onto this property. It should inherit from Model");
}).should.throw("Cannot set a non model entity onto this property. It should inherit from Model");
});

it("should throw when assign a non model object to a hasOne association", () => {
() => {
(() => {
truck.steeringWheel = {};
}.should.throw("Cannot set a non model entity onto this property. It should inherit from Model");
}).should.throw("Cannot set a non model entity onto this property. It should inherit from Model");
});

it("should associate a hasOne from a belongsTo", () => {
Expand Down

0 comments on commit 076741a

Please sign in to comment.