@sterblue/sterblue-sdk
Version:
Sterblue Graph SDK for graphile.sterblue.com
36 lines (33 loc) • 1.21 kB
JavaScript
;
var _basicSdk = require("../basic-sdk");
async function setupSdk() {
return await (0, _basicSdk.getApolloClientBasicSdk)({
uri: "https://beta.graphile.sterblue.com/graphql"
});
}
describe("getApolloClientBasicSdk", () => {
test("should return a configured SDK", async () => {
await expect((0, _basicSdk.getApolloClientBasicSdk)()).resolves.toBeDefined();
});
test("authenticate should not fail with valid credentials", async () => {
const sdk = await setupSdk();
const result = await sdk.authenticate({
email: "vincent.lecrubier@sterblue.com",
password: "underline-tiny-brown-carry-ride"
});
expect(result.authenticateUser).toHaveProperty("jwtUserToken");
});
test("authenticate should fail with invalid credentials", async () => {
const sdk = await setupSdk();
const result = await sdk.authenticate({
email: "test@invalid.mail",
password: "password"
});
expect(result.authenticateUser).toEqual({
__typename: "AuthenticateUserPayload",
jwtUserToken: null
}); // await expect(sdk.authenticate(credentials)).rejects.toThrow(
// "Response not successful: Received status code 400"
// );
});
});