Skip to content
This repository has been archived by the owner on Jan 10, 2020. It is now read-only.

Commit

Permalink
fix undefined resolver
Browse files Browse the repository at this point in the history
  • Loading branch information
James Baxley committed Aug 6, 2016
1 parent cb6b727 commit 0033c17
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 39 deletions.
2 changes: 1 addition & 1 deletion src/apollos/models/users/resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { createGlobalId } from "../../../util";
export default {
Query: {
currentUser(_: any, args: any, { user }: any): any {
return user;
return user || null;
},
},

Expand Down
62 changes: 30 additions & 32 deletions test/apollos/models/users/queries.integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,36 +25,34 @@ test.before(async (t) => {

});

test("allows a test to be passed", t => {
t.pass();

test("Valid queries should return success", async (t) => {
const response = await Heighliner(JSON.stringify({
query: `
query CurrentUser {
currentUser {
id
createdAt
emails {
address
}
services {
rock {
id
alias
}
resume {
tokens {
when
hashedToken
}
}
}
}
}
`,
}));
t.true(response.success);
t.is(response.status, 200);
t.truthy(response.data);
});
// test("Valid queries should return success", async (t) => {
// const response = await Heighliner(JSON.stringify({
// query:`
// query CurrentUser {
// currentUser {
// id
// createdAt
// emails {
// address
// }
// services {
// rock {
// id
// alias
// }
// resume {
// tokens {
// when
// hashedToken
// }
// }
// }
// }
// }
// `,
// }));
// t.true(response.success);
// t.is(response.status, 200);
// t.truthy(response.data);
// });
12 changes: 6 additions & 6 deletions test/server.integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ test.before(async (t) => {
});


// test("Valid queries should return success", async (t) => {
// const response = await Heighliner(JSON.stringify({ query: "{ currentUser { id } }" }));
// t.true(response.success);
// t.is(response.status, 200);
// t.truthy(response.data);
// });
test("Valid queries should return success", async (t) => {
const response = await Heighliner(JSON.stringify({ query: "{ currentUser { id } }" }));
t.true(response.success);
t.is(response.status, 200);
t.truthy(response.data);
});

test("Invalid queries should fail", async (t) => {
const response = await Heighliner(JSON.stringify({ query: "{ foobar { id } }" }));
Expand Down

0 comments on commit 0033c17

Please sign in to comment.