-
Notifications
You must be signed in to change notification settings - Fork 203
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from kaleido-io/aggregation-api
Add aggregation API Signed-off-by: Gabriel Indik <gabriel.indik@kaleido.io>
- Loading branch information
Showing
8 changed files
with
67 additions
and
4 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
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
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
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
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,34 @@ | ||
import { app } from '../common'; | ||
import request from 'supertest'; | ||
import assert from 'assert'; | ||
|
||
describe('Aggregation', async () => { | ||
|
||
it('Missing aggregation query', async () => { | ||
const result = await request(app) | ||
.post('/api/v1/assets/instances/aggregate') | ||
.expect(400); | ||
assert.deepStrictEqual(result.body, { error: 'Missing or invalid aggregation query' }); | ||
}); | ||
|
||
it('Invalid aggregation query', async () => { | ||
const result = await request(app) | ||
.post('/api/v1/assets/instances/aggregate') | ||
.send({ | ||
query: 'INVALID' | ||
}) | ||
.expect(400); | ||
assert.deepStrictEqual(result.body, { error: 'Missing or invalid aggregation query' }); | ||
}); | ||
|
||
it('Aggregation not supported in NeDB', async () => { | ||
const result = await request(app) | ||
.post('/api/v1/assets/instances/aggregate') | ||
.send({ | ||
query: [] | ||
}) | ||
.expect(400); | ||
assert.deepStrictEqual(result.body, { error: 'Aggregation not supported in NeDB' }); | ||
}); | ||
|
||
}); |