-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
158 additions
and
56 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,2 +1,2 @@ | ||
# What is MemServer? | ||
MemServer is an in-memory database/ORM and http mock server you can run in-browser and node environments. Extremely useful library for fast tests, rapid prototyping, single-file SPA demo deployments. | ||
MemServer is an in-memory database/ORM and http mock server you can run in-browser and node environments. Extremely useful library for fast frontend tests, rapid prototyping, single-file SPA demo deployments. |
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,7 @@ | ||
export default function() { | ||
export default function(Models) { | ||
// this.namespace = ''; | ||
|
||
this.get('/photos', () => { | ||
return { | ||
authors: [ | ||
] | ||
}; | ||
return { photos: Models.Photo.findAll() }; | ||
}); | ||
} |
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
File renamed without changes.
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export default function(statusCode=200, headers={}, data={}) { | ||
return [ | ||
statusCode, | ||
Object.assign({ 'Content-Type': 'application/json' }, headers), | ||
JSON.stringify(data) | ||
]; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export default class Server { | ||
constructor(options={}) { | ||
|
||
} | ||
|
||
|
||
} |
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 |
---|---|---|
|
@@ -26,6 +26,7 @@ | |
}, | ||
"devDependencies": { | ||
"jquery": "^3.2.1", | ||
"mocha": "^4.0.1", | ||
"pryjs": "^1.0.3" | ||
}, | ||
"@std/esm": { | ||
|
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// const assert = require('assert'); | ||
// | ||
// describe('MemServer', () => { | ||
// describe('requiring MemServer', () => { | ||
// it('should throw error if /memserver folder doesnt exist', () => { | ||
// // assert.equal(-1, [1,2,3].indexOf(4)); | ||
// }); | ||
// | ||
// it('should throw error if /memserver/server.js doesnt exist', () => { | ||
// // assert.equal(-1, [1,2,3].indexOf(4)); | ||
// }); | ||
// | ||
// it('exports not yet started MemServer with right functions, registered Models and empty DB', () => { | ||
// | ||
// }); | ||
// }); | ||
// | ||
// it('can be started with default options', () => { | ||
// | ||
// }); | ||
// | ||
// it('can be started with different options', () => { | ||
// | ||
// }); | ||
// | ||
// it('can be shut down', () => { | ||
// | ||
// }); | ||
// | ||
// it('can be shut down and started again with correct state', () => { | ||
// | ||
// }); | ||
// }); |
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// const assert = require('assert'); | ||
// | ||
// describe('MemServer.Model', () => { | ||
// describe('Query interface', () => { | ||
// it('find() throws without an id', () => { | ||
// assert.equal(-1, [1,2,3].indexOf(4)); | ||
// }); | ||
// | ||
// it('find(id) works for different models', () => { | ||
// assert.equal(-1, [1,2,3].indexOf(4)); | ||
// }); | ||
// | ||
// it('findBy() throws without params', () => { | ||
// | ||
// }); | ||
// | ||
// it('findBy(options) returns a single model for the options', () => { | ||
// | ||
// }); | ||
// | ||
// it('findAll() without parameters returns all the models in the database', () => { | ||
// | ||
// }) | ||
// | ||
// it('findAll(options) returns right models in the database', () => { | ||
// | ||
// }); | ||
// }); | ||
// | ||
// // describe('insert factory interface'); | ||
// // describe('update factory interface'); | ||
// // describe('destroy factory interface'); | ||
// | ||
// // describe('serialization interface'); | ||
// | ||
// // describe('complex operations') // multiple edit updates at once | ||
// // describe('custom query interface') // adding new queries etc | ||
// }); |
Empty file.
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// const assert = require('assert'); | ||
// | ||
// describe('MemServer.Server', () => { | ||
// // this options work | ||
// | ||
// // NOTE: multiple times: | ||
// // POST works multiple times | ||
// // PUT works | ||
// // DELETE works | ||
// // GET works | ||
// | ||
// // test based one-off mocking works | ||
// | ||
// // passthrough works | ||
// }); |