Skip to content

Commit

Permalink
add resource test
Browse files Browse the repository at this point in the history
  • Loading branch information
jmelis committed Feb 20, 2019
1 parent 6066f57 commit 9dfc284
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
8 changes: 7 additions & 1 deletion test/server.data.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
{
"resources": {},
"resources": {
"/resource1.yml": {
"path": "/resource1.yml",
"content": "test resource",
"sha256sum": "ff"
}
},
"data": {
"/role-A.yml": {
"$schema": "/access/role-1.yml",
Expand Down
20 changes: 20 additions & 0 deletions test/server.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,24 @@ describe('server', () => {
done();
});
});

it('can retrieve a resource', (done) => {
const query = `{
resources(path: "/resource1.yml") {
content
sha256sum
path
}
}`;

chai.request(server)
.get('/graphql')
.query({ query })
.end((err: any, res: any) => {
validateGraphQLResponse(res);
const resource = res.body.data.resources[0];
resource.content.should.equal('test resource');
done();
});
});
});

0 comments on commit 9dfc284

Please sign in to comment.