I'm currently testing a graphQL query string, however when I run the test, it fails. I'm not sure why the escape character is getting added to my expected value, any thoughts?
const expected = `{"query": "mutation {
anonymousConsentSet(
input: {\"name\":\"John Doe\",\"address\":\"123 Main St\",\"phoneNumber\":\"123456677\",\"emailAddress\":\"test@test.com\"}
)
}", "variables": ""}`;
const mockFormData = {
firstName: 'John',
lastName: 'Doe',
phone: '123456677',
address: '123 Main St',
email: 'test@test.com'
};
it('should get expected query', () => {
const output: any = createQuery(mockFormData);
expect(output).toBe(expected); // <------------This is failing because of unmatched escape characters
});
Notice the expected variable does not contain escape characters, so why is it showing after running the test below?
