diff --git a/src/adapters/SinonServer.spec.ts b/src/adapters/SinonServer.spec.ts index d7de34a..ed9012e 100644 --- a/src/adapters/SinonServer.spec.ts +++ b/src/adapters/SinonServer.spec.ts @@ -40,7 +40,7 @@ describe('SinonServer', () => { context.params.range = [start, end]; return next(request, context); }); - server.database.addCollection( + server.addCollection( 'foo', new Collection({ items: [ @@ -85,7 +85,7 @@ describe('SinonServer', () => { }; return response; }); - server.database.addCollection( + server.addCollection( 'foo', new Collection({ items: [ @@ -111,7 +111,7 @@ describe('SinonServer', () => { requestUrl = request.url; return next(request, context); }); - server.database.addCollection('foo', new Collection()); + server.addCollection('foo', new Collection()); const request = getFakeXMLHTTPRequest('GET', '/foo'); if (request == null) throw new Error('request is null'); @@ -132,7 +132,7 @@ describe('SinonServer', () => { it('should respond to GET /foo by sending all items in collection foo', async () => { const server = new SinonServer(); - server.database.addCollection( + server.addCollection( 'foo', new Collection({ items: [ @@ -159,7 +159,7 @@ describe('SinonServer', () => { it('should respond to GET /foo?queryString by sending all items in collection foo satisfying query', async () => { const server = new SinonServer(); - server.database.addCollection( + server.addCollection( 'foos', new Collection({ items: [ @@ -169,7 +169,7 @@ describe('SinonServer', () => { ], }), ); - server.database.addCollection( + server.addCollection( 'bars', new Collection({ items: [{ id: 0, name: 'a', foo_id: 1 }] }), ); @@ -194,7 +194,7 @@ describe('SinonServer', () => { it('should respond to GET /foo?queryString with pagination by sending the correct content-range header', async () => { const server = new SinonServer(); - server.database.addCollection( + server.addCollection( 'foo', new Collection({ items: [{}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}], @@ -233,7 +233,7 @@ describe('SinonServer', () => { it('should respond to GET /foo on an empty collection with a []', async () => { const server = new SinonServer(); - server.database.addCollection('foo', new Collection()); + server.addCollection('foo', new Collection()); const request = getFakeXMLHTTPRequest('GET', '/foo'); if (request == null) throw new Error('request is null'); await server.handle(request); @@ -247,7 +247,7 @@ describe('SinonServer', () => { it('should respond to POST /foo by adding an item to collection foo', async () => { const server = new SinonServer(); - server.database.addCollection( + server.addCollection( 'foo', new Collection({ items: [ @@ -300,7 +300,7 @@ describe('SinonServer', () => { it('should respond to GET /foo/:id by sending element of identifier id in collection foo', async () => { const server = new SinonServer(); - server.database.addCollection( + server.addCollection( 'foo', new Collection({ items: [ @@ -322,7 +322,7 @@ describe('SinonServer', () => { it('should respond to GET /foo/:id on a non-existing id with a 404', async () => { const server = new SinonServer(); - server.database.addCollection('foo', new Collection()); + server.addCollection('foo', new Collection()); const request = getFakeXMLHTTPRequest('GET', '/foo/3'); if (request == null) throw new Error('request is null'); await server.handle(request); @@ -331,7 +331,7 @@ describe('SinonServer', () => { it('should respond to PUT /foo/:id by updating element of identifier id in collection foo', async () => { const server = new SinonServer(); - server.database.addCollection( + server.addCollection( 'foo', new Collection({ items: [ @@ -361,7 +361,7 @@ describe('SinonServer', () => { it('should respond to PUT /foo/:id on a non-existing id with a 404', async () => { const server = new SinonServer(); - server.database.addCollection('foo', new Collection({ items: [] })); + server.addCollection('foo', new Collection({ items: [] })); const request = getFakeXMLHTTPRequest( 'PUT', '/foo/3', @@ -374,7 +374,7 @@ describe('SinonServer', () => { it('should respond to PATCH /foo/:id by updating element of identifier id in collection foo', async () => { const server = new SinonServer(); - server.database.addCollection( + server.addCollection( 'foo', new Collection({ items: [ @@ -404,7 +404,7 @@ describe('SinonServer', () => { it('should respond to PATCH /foo/:id on a non-existing id with a 404', async () => { const server = new SinonServer(); - server.database.addCollection('foo', new Collection({ items: [] })); + server.addCollection('foo', new Collection({ items: [] })); const request = getFakeXMLHTTPRequest( 'PATCH', '/foo/3', @@ -417,7 +417,7 @@ describe('SinonServer', () => { it('should respond to DELETE /foo/:id by removing element of identifier id in collection foo', async () => { const server = new SinonServer(); - server.database.addCollection( + server.addCollection( 'foo', new Collection({ items: [ @@ -442,7 +442,7 @@ describe('SinonServer', () => { it('should respond to DELETE /foo/:id on a non-existing id with a 404', async () => { const server = new SinonServer(); - server.database.addCollection('foo', new Collection({ items: [] })); + server.addCollection('foo', new Collection({ items: [] })); const request = getFakeXMLHTTPRequest('DELETE', '/foo/3'); if (request == null) throw new Error('request is null'); await server.handle(request); @@ -451,7 +451,7 @@ describe('SinonServer', () => { it('should respond to GET /foo/ with single item', async () => { const server = new SinonServer(); - server.database.addSingle('foo', new Single({ name: 'foo' })); + server.addSingle('foo', new Single({ name: 'foo' })); const request = getFakeXMLHTTPRequest('GET', '/foo'); if (request == null) throw new Error('request is null'); @@ -466,7 +466,7 @@ describe('SinonServer', () => { it('should respond to PUT /foo/ by updating the singleton record', async () => { const server = new SinonServer(); - server.database.addSingle('foo', new Single({ name: 'foo' })); + server.addSingle('foo', new Single({ name: 'foo' })); const request = getFakeXMLHTTPRequest( 'PUT', @@ -486,7 +486,7 @@ describe('SinonServer', () => { it('should respond to PATCH /foo/ by updating the singleton record', async () => { const server = new SinonServer(); - server.database.addSingle('foo', new Single({ name: 'foo' })); + server.addSingle('foo', new Single({ name: 'foo' })); const request = getFakeXMLHTTPRequest( 'PATCH', @@ -508,7 +508,7 @@ describe('SinonServer', () => { describe('setDefaultQuery', () => { it('should set the default query string', async () => { const server = new SinonServer(); - server.database.addCollection( + server.addCollection( 'foo', new Collection({ items: [{}, {}, {}, {}, {}, {}, {}, {}, {}, {}], @@ -531,7 +531,7 @@ describe('SinonServer', () => { it('should not override any provided query string', async () => { const server = new SinonServer(); - server.database.addCollection( + server.addCollection( 'foo', new Collection({ items: [{}, {}, {}, {}, {}, {}, {}, {}, {}, {}],