@projectinvicta/nails 2.0.15 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/README.md +70 -84
  2. package/bin/lib/init.js +0 -4
  3. package/bin/test/test_init.sh +33 -0
  4. package/index.ts +11 -0
  5. package/lib/Controller.ts +207 -0
  6. package/lib/Nails.ts +210 -0
  7. package/lib/Router.ts +180 -0
  8. package/lib/{application.js → application.ts} +8 -3
  9. package/lib/config.ts +74 -0
  10. package/package.json +17 -15
  11. package/templates/default/config/db.ts +13 -0
  12. package/{spec/services/integration_sequelize/config/mimes.js → templates/default/config/mimes.ts} +42 -61
  13. package/templates/default/config/routes.ts +22 -0
  14. package/templates/default/config/{service.js → service.ts} +2 -2
  15. package/templates/default/package.json +8 -2
  16. package/templates/default/public/README.xml +68 -85
  17. package/templates/default/server/controllers/home_controller.js +2 -2
  18. package/templates/{server/controllers/home_controller.js → default/server/controllers/users_controller.ts} +29 -34
  19. package/templates/default/server/models/Dog.ts +8 -0
  20. package/templates/default/server/models/User.ts +14 -0
  21. package/templates/default/spec/User.test.js +7 -5
  22. package/templates/default/spec/home_controller.test.js +3 -3
  23. package/tests/bin/init.spec.js +3 -0
  24. package/tests/controller.spec.js +61 -0
  25. package/tests/nails.spec.js +4 -0
  26. package/tests/router.spec.js +105 -0
  27. package/tests/services/integration/config/db.ts +7 -0
  28. package/{spec/services/integration_sequelize → tests/services/integration}/config/service.js +8 -8
  29. package/{spec → tests}/services/integration/server/controllers/classbased_controller.js +2 -2
  30. package/tests/services/integration/server/controllers/default_json_controller.js +32 -0
  31. package/{spec → tests}/services/integration/server/controllers/error_controller.js +2 -2
  32. package/tests/services/integration/server/controllers/home_controller.js +17 -0
  33. package/{spec → tests}/services/integration/server/controllers/json_controller.js +2 -2
  34. package/{spec → tests}/services/integration/server/controllers/manualrenderasync_controller.js +2 -2
  35. package/tests/services/integration/server/controllers/mjs_controller.mjs +9 -0
  36. package/tests/services/integration/server/controllers/modeltest_controller.js +15 -0
  37. package/{spec → tests}/services/integration/server/controllers/websocket_controller.js +1 -1
  38. package/tests/services/integration/server/models/dog.js +8 -0
  39. package/tests/services/integration/server/models/owner.js +13 -0
  40. package/{spec/services/integration_sequelize → tests/services/integration}/server.js +3 -4
  41. package/tests/services.integration.spec.js +210 -0
  42. package/vite.config.ts +23 -0
  43. package/index.js +0 -6
  44. package/lib/collection.js +0 -6
  45. package/lib/controller.js +0 -182
  46. package/lib/database_connector.js +0 -12
  47. package/lib/firebase_connector.js +0 -94
  48. package/lib/model_v2.js +0 -24
  49. package/lib/mongoose_connector.js +0 -49
  50. package/lib/mongoose_mem_connector.js +0 -21
  51. package/lib/nails.js +0 -244
  52. package/lib/router.js +0 -202
  53. package/lib/sequelize_connector.js +0 -31
  54. package/lib/server.js +0 -1
  55. package/spec/bin/init.spec.js +0 -0
  56. package/spec/controller.spec.js +0 -105
  57. package/spec/model_v2.spec.js +0 -75
  58. package/spec/mongodb_connector.util.js +0 -30
  59. package/spec/mongoose_connector.util.js +0 -20
  60. package/spec/nails.spec.js +0 -0
  61. package/spec/router.spec.js +0 -101
  62. package/spec/sequelize_connector.spec.js +0 -91
  63. package/spec/sequelize_connector.util.js +0 -18
  64. package/spec/services/integration/config/db.js +0 -14
  65. package/spec/services/integration/config/service.js +0 -48
  66. package/spec/services/integration/server/controllers/default_json_controller.js +0 -20
  67. package/spec/services/integration/server/controllers/home_controller.js +0 -39
  68. package/spec/services/integration/server/controllers/mjs_controller.mjs +0 -13
  69. package/spec/services/integration/server/controllers/modeltest_controller.js +0 -18
  70. package/spec/services/integration/server/models/dog.js +0 -6
  71. package/spec/services/integration/server.js +0 -9
  72. package/spec/services/integration_sequelize/README.md +0 -5
  73. package/spec/services/integration_sequelize/client/css/styles.css +0 -0
  74. package/spec/services/integration_sequelize/client/download.jpg +0 -0
  75. package/spec/services/integration_sequelize/client/favicon.ico +0 -0
  76. package/spec/services/integration_sequelize/client/index.html +0 -9
  77. package/spec/services/integration_sequelize/client/js/client.js +0 -0
  78. package/spec/services/integration_sequelize/client/js/components/app.jsx +0 -15
  79. package/spec/services/integration_sequelize/config/db.js +0 -4
  80. package/spec/services/integration_sequelize/config/routes.js +0 -25
  81. package/spec/services/integration_sequelize/config/ssl/certificate.pem +0 -22
  82. package/spec/services/integration_sequelize/config/ssl/csr.csr +0 -17
  83. package/spec/services/integration_sequelize/config/ssl/key.pem +0 -28
  84. package/spec/services/integration_sequelize/config/ssl/private_key.pem +0 -30
  85. package/spec/services/integration_sequelize/config/ssl/public_key.pem +0 -9
  86. package/spec/services/integration_sequelize/package.json +0 -23
  87. package/spec/services/integration_sequelize/server/controllers/default_json_controller.js +0 -21
  88. package/spec/services/integration_sequelize/server/controllers/home_controller.js +0 -39
  89. package/spec/services/integration_sequelize/server/models/dog.js +0 -7
  90. package/spec/services/integration_sequelize/server/models/owner.js +0 -10
  91. package/spec/services/integration_sequelize/server/views/defaultjson/testnojson.ejs +0 -1
  92. package/spec/services/integration_sequelize/server/views/testreact/testreact.ejs +0 -15
  93. package/spec/services.integration.spec.js +0 -296
  94. package/spec/services.integration_sequelize.spec.js +0 -60
  95. package/templates/bin/promote.sh +0 -20
  96. package/templates/bin/rollout.sh +0 -74
  97. package/templates/bin/server.js +0 -6
  98. package/templates/bin/start.sh +0 -16
  99. package/templates/common/readme_fetcher.js +0 -4
  100. package/templates/config/db.js +0 -19
  101. package/templates/config/mimes.js +0 -59
  102. package/templates/config/routes.js +0 -38
  103. package/templates/config/service.js +0 -45
  104. package/templates/config/ssl/certificate.pem +0 -22
  105. package/templates/config/ssl/csr.csr +0 -17
  106. package/templates/config/ssl/key.pem +0 -28
  107. package/templates/config/ssl/private_key.pem +0 -30
  108. package/templates/config/ssl/public_key.pem +0 -9
  109. package/templates/default/config/db.js +0 -19
  110. package/templates/default/config/mimes.js +0 -59
  111. package/templates/default/config/routes.js +0 -38
  112. package/templates/default/server/models/User.js +0 -18
  113. package/templates/package-lock.json +0 -9048
  114. package/templates/package.json +0 -43
  115. package/templates/public/README.xml +0 -332
  116. package/templates/public/css/styles.css +0 -17
  117. package/templates/public/download.jpg +0 -0
  118. package/templates/public/favicon.ico +0 -0
  119. package/templates/public/index.html +0 -9
  120. package/templates/public/js/client.js +0 -1
  121. package/templates/server/models/User.js +0 -18
  122. package/templates/server/views/home/index.ejs +0 -14
  123. package/templates/server/views/partials/javascripts.ejs +0 -1
  124. package/templates/server/views/partials/reactapp.ejs +0 -1
  125. package/templates/server/views/partials/styles.ejs +0 -3
  126. package/templates/spec/User.test.js +0 -20
  127. package/templates/spec/home_controller.test.js +0 -28
  128. package/templates/spec/setupTests.js +0 -0
  129. package/templates/src/AboutPage.jsx +0 -9
  130. package/templates/src/HomePage.jsx +0 -9
  131. package/templates/src/Layout.jsx +0 -78
  132. package/templates/src/ReadmePage.jsx +0 -7
  133. package/templates/src/app.jsx +0 -29
  134. package/templates/src/components/ReadmeLoader.jsx +0 -13
  135. package/templates/src/styles/appstyles.css +0 -3
  136. package/templates/vite.config.ts +0 -42
  137. /package/{spec → tests}/services/integration/README.md +0 -0
  138. /package/{spec → tests}/services/integration/client/css/styles.css +0 -0
  139. /package/{spec → tests}/services/integration/client/download.jpg +0 -0
  140. /package/{spec → tests}/services/integration/client/favicon.ico +0 -0
  141. /package/{spec → tests}/services/integration/client/index.html +0 -0
  142. /package/{spec → tests}/services/integration/client/js/client.js +0 -0
  143. /package/{spec → tests}/services/integration/client/js/components/app.jsx +0 -0
  144. /package/{spec → tests}/services/integration/config/mimes.js +0 -0
  145. /package/{spec → tests}/services/integration/config/routes.js +0 -0
  146. /package/{spec → tests}/services/integration/config/ssl/certificate.pem +0 -0
  147. /package/{spec → tests}/services/integration/config/ssl/csr.csr +0 -0
  148. /package/{spec → tests}/services/integration/config/ssl/key.pem +0 -0
  149. /package/{spec → tests}/services/integration/config/ssl/private_key.pem +0 -0
  150. /package/{spec → tests}/services/integration/config/ssl/public_key.pem +0 -0
  151. /package/{spec → tests}/services/integration/package.json +0 -0
  152. /package/{spec → tests}/services/integration/server/views/defaultjson/testnojson.ejs +0 -0
  153. /package/{spec → tests}/services/integration/server/views/testreact/testreact.ejs +0 -0
@@ -1,25 +0,0 @@
1
- /**
2
- * Routes specifies the array of route definitions to be passed to the router
3
- *
4
- * Routes are checked in series, and the first matching route is applied.
5
- * A route definition is as follows:
6
- * ['METHOD', 'MATCHER', 'OPTIONS']
7
- *
8
- * METHOD => crud methods (GET, PUT, POST, DELETE)
9
- * MATCHER => to be matched against the path. Captured elements will be passed to options. Delegates to express application routing.
10
- * OPTIONS => an object with parametes deciding how the route will be handled in order of execution:
11
- * path: => the path to a static file ( index.html f/e)
12
- * controller: => controller to route the request to. TODO: May implement a resource definition for automatically routing cruds
13
- * action: => the method to run in the controller. If not specified, the index method will be called.
14
- * [1..n]: => each numerical definition defines a parameter in which to store the value of the captured elements in the regex.
15
- * controller, and action are protected names and will apply the cature to controller name and method respectively.
16
- * f/e: ['get', /\/(home)/, {0: 'controller'}] => routes to home controller
17
- * ['get, '/\/home\/(5)/, {controller: 'home', 0: 'id'}] => routes to home controller and adds {id: 5} to the params hash.
18
- */
19
-
20
- var routes = [
21
- // Routes the root request to index.html, as well as all other requests to static
22
- ['get', "/", {controller: 'home'}],
23
- ];
24
-
25
- export default routes;
@@ -1,22 +0,0 @@
1
- -----BEGIN CERTIFICATE-----
2
- MIIDrzCCApegAwIBAgIUR04h3qlfhW5SYQrnm0VjDSLQrwUwDQYJKoZIhvcNAQEL
3
- BQAwZzELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAkNBMQ4wDAYDVQQKDAVOYWlsczES
4
- MBAGA1UEAwwJbG9jYWxob3N0MScwJQYJKoZIhvcNAQkBFhhhZG1pbkBwcm9qZWN0
5
- aW52aWN0YS5jb20wHhcNMjMwODMwMDE1MzUzWhcNMjQwODI5MDE1MzUzWjBnMQsw
6
- CQYDVQQGEwJVUzELMAkGA1UECAwCQ0ExDjAMBgNVBAoMBU5haW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2yHlUr+A8j6KHQw5mr3GnoOoeQTdZYK594m
24
- N6J/gxF1emQqJoP+i+mx7iSdf5i2DmV9ACl/tyU92PKocIcsYoIevSmhtliBnsdG
25
- R1kPkoUWuEVZujxzlIXcj0vEtOxyKJmzlBXKKO7B8U4HociBNMM41acX9WsIYdsA
26
- QFjZTyU2DkpOCPRcBFbgQFPwfrkC93hndiByWPCkmAjeHJ0O74fnBCUP5BhmFuuc
27
- /L0WWAVKp8HGgFmiq+i+rznJZEEEEoZClDFNkOBp4yfGZL9yZ2Ot3IRb2HNIJaj1
28
- 69CX7ukHVHPLgiOcRSbFyuZZyqO++kWgEQm5jKlFFqGyFNpHmkGL8CGFlq7x9sF7
29
- ONozML/sxGNw4Ubo6TAPflvl7KOd9bcYJdpODqtJgngi
30
- -----END ENCRYPTED PRIVATE KEY-----
@@ -1,9 +0,0 @@
1
- ---- BEGIN SSH2 PUBLIC KEY ----
2
- Comment: "2048-bit RSA, converted by stantonwjones@darkmatter.lan from"
3
- AAAAB3NzaC1yc2EAAAADAQABAAABAQDPJQsK/daFi/b+7bOSEJcKdzjvNJygX3BvMQ4HY+
4
- JJaiSDyQgtwc8K85XDH0/eWyu5a6OzbadU3SkSdYP+0+uTdxfxRUCChKoASIoAaAfwB/BW
5
- WOIdsuGPhJjYiLnPL4SScFdjUbJXGP5JOSQ6wgsRdqsDeQezUjF0CvR1CXoJaqRQt7p5T9
6
- TlRzzuhN5Vf6BDpXBPTcNyUGKCaUwGQn2QmpXzRXrAZNb7XpzBSXdpUWm9W7U9zCFHva7J
7
- XCuXsC9yMy3w1mpbL+oFBx7Wvic5FqwnATXjM7xBSqcG4tYzrISyn5pj13cIzzk9aEPRI3
8
- qhV6kiA62JofiX1RkxMP+j
9
- ---- END SSH2 PUBLIC KEY ----
@@ -1,23 +0,0 @@
1
- {
2
- "name": "nails_app",
3
- "version": "0.0.0",
4
- "description": "A basic nails application",
5
- "main": "server.js",
6
- "type": "module",
7
- "scripts": {
8
- "test": "echo \"Error: no test specified\" && exit 1",
9
- "start": "node server.js"
10
- },
11
- "author": "",
12
- "license": "BSD",
13
- "bugs": {
14
- "url": "https://github.com/stantonwjones/nails-boilerplate/issues"
15
- },
16
- "config": {
17
- "mongodbMemoryServer": {
18
- "version": "latest"
19
- }
20
- },
21
- "dependencies": {
22
- }
23
- }
@@ -1,21 +0,0 @@
1
- import nails from "../../../../../index.js";
2
- import Dog from "../models/dog.js";
3
- import Owner from "../models/owner.js";
4
-
5
- export default class DefaultJsonController extends nails.Controller {
6
- json = true;
7
- routes = [
8
- ['get', '/listowners'],
9
- ['get', '/listowneddogs'],
10
- ];
11
-
12
- async listowners(params, request, response) {
13
- return await Owner.findAll();
14
- }
15
-
16
- async listowneddogs(params, request, response) {
17
- // await nails._dbConnector.afterInitialization();
18
- // await Dog.sync({alter: true});
19
- return await Dog.findAll();
20
- }
21
- }
@@ -1,39 +0,0 @@
1
- export default function HomeController() {
2
- this.index = function(params, request, response) {
3
- console.log("HOME::INDEX");
4
- response.json({
5
- home_index: true
6
- });
7
- };
8
- this.testaction = function(params, request, response) {
9
- response.json({
10
- home_testaction: true
11
- });
12
- }
13
- this.test_ejs = function() {
14
- };
15
- /*
16
- this.public_index = function(params, request, response) {
17
- response.public({path: 'index.html'});
18
- };
19
- this.json = function(params, request, response) {
20
- response.json({test: 'json'});
21
- };
22
- // By setting a method to asynchronous, Nails will wait for an
23
- // explicit response to the client. Otherwise, it will attempt
24
- // to respond with a view immediately after the action terminates.
25
- this.json.async = true;
26
-
27
- this.test_model = function(params, request, response) {
28
- var u = new User();
29
- u.set('created_at', (new Date()).getTime());
30
- u.save();
31
- response.json({new_user_id: u.id.toString()});
32
- };
33
- this.test_id_template = function(params, request, response) {
34
- var varz = {};
35
- varz.id = params.id || "no id set";
36
- response.render('test_id', varz);
37
- };
38
- */
39
- }
@@ -1,7 +0,0 @@
1
- import nails from '../../../../../index.js';
2
- import { DataTypes } from 'sequelize';
3
- const dogSchema = {
4
- good: DataTypes.BOOLEAN,
5
- name: DataTypes.STRING,
6
- };
7
- export default class Dog extends new nails.Model("Dog", dogSchema) {};
@@ -1,10 +0,0 @@
1
- import nails from '../../../../../index.js';
2
- import { DataTypes } from 'sequelize';
3
- import Dog from './dog.js';
4
- const ownerSchema = {
5
- name: DataTypes.STRING,
6
- };
7
- class Owner extends new nails.Model("Owner", ownerSchema) {};
8
- Owner.hasMany(Dog);
9
- await Dog.sync();
10
- export default Owner;
@@ -1,15 +0,0 @@
1
- /* jshint esversion: 6 */
2
- var React = require('react');
3
-
4
- class TestReact extends React.Component {
5
- render() {
6
- return (
7
- <html>
8
- <head><title>react</title></head>
9
- <body>react works!</body>
10
- </html>
11
- );
12
- }
13
- }
14
-
15
- module.exports = TestReact;
@@ -1,296 +0,0 @@
1
- // Import the dependencies for testing
2
- import * as chai from 'chai';
3
- import { default as chaiHttp, request } from "chai-http";
4
- // import chaiHttp from 'chai-http';
5
- import { assert } from 'chai';
6
- // import { WebSocket } from 'ws';
7
- import WebSocket from 'ws';
8
- // const WebSocket = require('ws');
9
-
10
- var express_app;
11
- // const {MongoMemoryServer} = require('mongodb-memory-server');
12
- let mongod = null;
13
-
14
- // Configure chai
15
- chai.use(chaiHttp);
16
- chai.should();
17
-
18
- describe("Integration: Sequelize", function () {
19
- before(async function () {
20
- // this.timeout(30000);
21
- try {
22
- var nails = (await import('./services/integration/server.js')).default;
23
- } catch (e) {
24
- console.log("could not import server");
25
- console.log(e);
26
- }
27
- console.log("got here");
28
- express_app = nails.application;
29
- });
30
- describe("GET /", function () {
31
- it('should return the expected JSON from index', function (done) {
32
- request.execute(express_app)
33
- .get('/')
34
- .end((err, res) => {
35
- res.should.have.status(200);
36
- assert(res.text == JSON.stringify({ home_index: true }));
37
- done();
38
- });
39
- });
40
- });
41
- describe("GET /classbased", function () {
42
- it('should return the expected JSON from index', function (done) {
43
- request.execute(express_app)
44
- .get('/classbased')
45
- .end((err, res) => {
46
- res.should.have.status(200);
47
- assert(res.text == JSON.stringify({ classbased_index: true }));
48
- done();
49
- });
50
- });
51
- });
52
- describe("Get /classbased/arbi/trary/testLocalRoutes", function () {
53
- it("Should respect the defined local route and return the expected JSON", function (done) {
54
- request.execute(express_app)
55
- .get('/classbased/arbi00/trary00/testLocalRoutes')
56
- .end((err, res) => {
57
- res.should.have.status(200);
58
- assert(res.text == JSON.stringify({ testLocalRoutes: true }));
59
- done();
60
- });
61
- });
62
- it("Should not rewrite local route prefix and return the expected JSON", function (done) {
63
- request.execute(express_app)
64
- .get('/cl4ssb4sed/arbi/trary/testLocalRoutes')
65
- .end((err, res) => {
66
- res.should.have.status(200);
67
- assert(res.text == JSON.stringify({ testLocalRoutes: true }));
68
- done();
69
- });
70
- });
71
- it("Should rewrite local route prefix, './' and return the expected JSON", function (done) {
72
- request.execute(express_app)
73
- .get('/classbased/arbi/trary/testLocalRoutes')
74
- .end((err, res) => {
75
- res.should.have.status(200);
76
- assert(res.text == JSON.stringify({ testLocalRoutes: true }));
77
- done();
78
- });
79
- });
80
- });
81
- describe("Get /defaultjson/arbi/trary", function () {
82
- it("Should default to json if not present in route options", function(done) {
83
- request.execute(express_app)
84
- .get('/defaultjson/arbi/trary/testautojson')
85
- .end((err, res) => {
86
- res.should.have.status(200);
87
- assert(res.text == JSON.stringify({ json_testautojson: true }));
88
- done();
89
- });
90
- });
91
- it("Should autoassign the action if not present in route options", function(done) {
92
- request.execute(express_app)
93
- .get('/defaultjson/arbi/trary/testautoaction')
94
- .end((err, res) => {
95
- res.should.have.status(200);
96
- assert(res.text == JSON.stringify({ json_testautoaction: true }));
97
- done();
98
- });
99
- });
100
- it("Should not render json if route options explicitly say not to", function(done) {
101
- request.execute(express_app)
102
- .get('/defaultjson/arbi/trary/testjsonoverridden')
103
- .end((err, res) => {
104
- res.should.have.status(200);
105
- assert(res.text == 'I am some arbitrary text');
106
- done();
107
- });
108
- })
109
- });
110
- describe("GET /^\\/(\\w+)\\/(\\w+)$/i", function () {
111
- it('should route to home_controller#testaction', function (done) {
112
- request.execute(express_app)
113
- .get('/home/testaction')
114
- .end((err, res) => {
115
- res.should.have.status(200);
116
- assert(res.text == JSON.stringify({ home_testaction: true }));
117
- done();
118
- });
119
- });
120
- it('should route to classbased_controller#testaction', function (done) {
121
- request.execute(express_app)
122
- .get('/classbased/testaction')
123
- .end((err, res) => {
124
- res.should.have.status(200);
125
- assert(res.text == JSON.stringify({ classbased_testaction: true }));
126
- done();
127
- });
128
- });
129
- it('should render correctly when a promise is returned', function (done) {
130
- request.execute(express_app)
131
- .get('/classbased/testpromise')
132
- .end((err, res) => {
133
- res.should.have.status(200);
134
- assert(res.text == JSON.stringify({ classbased_testpromise: true }));
135
- done();
136
- });
137
- })
138
- });
139
-
140
- describe("GET /error/fivehundred", function () {
141
- it('should log the stack trace', function (done) {
142
- request.execute(express_app)
143
- .get('/error/fivehundred/500')
144
- .end((err, res) => {
145
- res.should.have.status(500);
146
- //console.log(res.text);
147
- //console.log(res);
148
- //console.log(err);
149
- done();
150
- })
151
- });
152
- it('should return meaningful JSON', function (done) {
153
- request.execute(express_app)
154
- .get('/error/fivehundred')
155
- .end((err, res) => {
156
- res.should.have.status(500);
157
- console.log("ZZZZZZZZZZ");
158
- console.log(res.text);
159
- //console.log(res.text);
160
- //console.log(res);
161
- //console.log(err);
162
- done();
163
- })
164
- });
165
- });
166
-
167
- describe("WebSockets", function () {
168
- it("should listen on /", function (done) {
169
- this.timeout(2000);
170
- var requester = request.execute(express_app).keepOpen();
171
- var wsClient = new WebSocket("ws://localhost:3333/");
172
-
173
- wsClient.on('close', () => done());
174
- wsClient.on('message', (message) => {
175
- assert(message == "It worked");
176
- });
177
- });
178
- it("should listen on /voodoo", function (done) {
179
- this.timeout(2000);
180
- var requester = request.execute(express_app).keepOpen();
181
- var wsClient = new WebSocket("ws://localhost:3333/voodoo");
182
-
183
- wsClient.on('message', (message) => {
184
- assert(message == "Voodoo worked");
185
- });
186
- wsClient.on('close', (code, reason) => done());
187
- });
188
- it("should not listen on /voodootwo", function (done) {
189
- // TODO: this doesn't fail. Figure out why.
190
- //done();
191
- this.timeout(2000);
192
- var requester = request.execute(express_app).keepOpen();
193
- var wsClient = new WebSocket("ws://localhost:3333/voodootwo");
194
-
195
- wsClient.on('close', (code, reason) => {
196
- console.log('voodootwo closed', code, reason);
197
- done();
198
- });
199
- debugger;
200
- });
201
- it("should be closed with the correct code if the action is absent");
202
- it("should be closed with the correct code if the controller is absent");
203
- it("should correctly parse the params");
204
- it("should correctly handle dynamic controller and action");
205
- });
206
-
207
- describe("GET /json/:action", function () {
208
- it('should render params if nothing is returned by the action',
209
- function (done) {
210
- request.execute(express_app)
211
- // Route to index action.
212
- .get('/json/testparams?testkey=testvalue')
213
- .end((err, res) => {
214
- res.should.have.status(200);
215
- assert(JSON.parse(res.text).testkey == "testvalue");
216
- done();
217
- });
218
- }
219
- );
220
- it('should render the returned object as json', function (done) {
221
- request.execute(express_app)
222
- .get('/json/testaction')
223
- .end((err, res) => {
224
- res.should.have.status(200);
225
- assert(res.text == JSON.stringify({ json_testaction: true }));
226
- done();
227
- });
228
- });
229
- it('should asynchronously render the resolved promise as json',
230
- function (done) {
231
- request.execute(express_app)
232
- .get('/json/testpromise')
233
- .end((err, res) => {
234
- res.should.have.status(200);
235
- assert(res.text == JSON.stringify({ json_testpromise: true }));
236
- done();
237
- });
238
- }
239
- );
240
- });
241
- describe("Get /ManualRenderAsync", function () {
242
- it("./testmanualrenderasync Should not throw an exception after manually"
243
- + " rendering json asynchronously",
244
- done => {
245
- request.execute(express_app)
246
- .get("/manualrenderasync/testmanualrenderasync")
247
- .end((err, res) => {
248
- res.should.have.status(200);
249
- assert(res.text ==
250
- JSON.stringify({ json_testmanualrenderasync: true }));
251
- done();
252
- });
253
- });
254
-
255
- it("./testmanualrenderexplicitasync Should not throw an exception after"
256
- + " manually rendering json asynchronously using the async function"
257
- + " tag",
258
- done => {
259
- request.execute(express_app)
260
- .get("/manualrenderasync/testmanualrenderexplicitasync")
261
- .end((err, res) => {
262
- res.should.have.status(200);
263
- assert(res.text ==
264
- JSON.stringify({ json_testmanualrenderexplicitasync: true }));
265
- done();
266
- });
267
- });
268
-
269
- });
270
- describe("Mongoose Model", function () {
271
- beforeEach(async function () {
272
- // Used to initialize mongod here
273
- });
274
- afterEach(async function () {
275
- //await mongod.stop();
276
- });
277
- it('should save to the correct database', function (done) {
278
- let dogName = "Penny";
279
- let dogId = null;
280
- request.execute(express_app)
281
- .get(`/modeltest/createdog?name=${dogName}`)
282
- .end((err, res) => {
283
- res.should.have.status(200);
284
- dogId = res.text.replaceAll('"', '');
285
- request.execute(express_app)
286
- .get(`/modeltest/getdogbyid?id=${dogId}`)
287
- .end((err, res) => {
288
- assert.equal(
289
- res.text, JSON.stringify({ name: dogName, good: true }));
290
- done();
291
- });
292
- });
293
- });
294
-
295
- });
296
- });
@@ -1,60 +0,0 @@
1
- import * as chai from 'chai';
2
- import { default as chaiHttp, request } from "chai-http";
3
- // import chaiHttp from 'chai-http';
4
- import { assert } from 'chai';
5
- // import { WebSocket } from 'ws';
6
- import WebSocket from 'ws';
7
- // const WebSocket = require('ws');
8
-
9
- var express_app;
10
-
11
- // Configure chai
12
- chai.use(chaiHttp);
13
- chai.should();
14
-
15
- describe("Integration", function () {
16
- before(async function () {
17
- try {
18
- var nails = (await import('./services/integration_sequelize/server.js')).default;
19
- } catch (e) {
20
- console.log("could not import server");
21
- console.log(e);
22
- }
23
- console.log("got here");
24
- express_app = nails.application;
25
- });
26
- describe("GET /", function () {
27
- it('should return the expected JSON from index', function (done) {
28
- request.execute(express_app)
29
- .get('/')
30
- .end((err, res) => {
31
- if (err) console.error(err);
32
- res.should.have.status(200);
33
- assert(res.text == JSON.stringify({ home_index: true }));
34
- done();
35
- });
36
- });
37
- });
38
- describe("/listowners", function() {
39
- it('should return an empty array if no owners', function(done) {
40
- request.execute(express_app)
41
- .get('/listowners')
42
- .end((err, res) => {
43
- res.should.have.status(200);
44
- assert(JSON.parse(res.text).length == 0);
45
- done();
46
- });
47
- })
48
- })
49
- describe("/listowneddogs", function() {
50
- it('should return an empty array if no owned dogs', function(done) {
51
- request.execute(express_app)
52
- .get('/listowneddogs')
53
- .end((err, res) => {
54
- res.should.have.status(200);
55
- assert(JSON.parse(res.text).length == 0);
56
- done();
57
- });
58
- })
59
- })
60
- });
@@ -1,20 +0,0 @@
1
- version=$1
2
- if [ "$version" == "" ]; then
3
- version="live"
4
- fi
5
-
6
- if [ "$version" != "live" ] &&
7
- [ "$version" != "development" ] &&
8
- [ "$version" != "staging_qa" ] &&
9
- [ "$version" != "staging_prod" ] &&
10
- [ "$version" != "production" ]; then
11
- echo "$version is not a valid version"
12
- exit 1
13
- fi
14
-
15
- # TODO: make sure we're on the master branch
16
- git pull origin master
17
- git tag -d $version
18
- git push origin --delete $version
19
- git tag $version
20
- git push origin $version