Fix zapier (#2735)

* Fix zapier tests

* Handle nested fields

* Code review returns
This commit is contained in:
martmull
2023-11-27 18:09:21 +01:00
committed by GitHub
parent e2e871ca32
commit a413b29dd4
10 changed files with 137 additions and 80 deletions

View File

@ -19,13 +19,12 @@ describe('triggers.company', () => {
requestDb(
z,
bundle,
`query findManyWebHook {findManyWebHook(where: {id: {equals: "${result.id}"}}){id operation}}`,
`query webhook {webhook(filter: {id: {eq: "${result.id}"}}){id operation}}`,
),
bundle,
);
expect(checkDbResult.data.findManyWebHook.length).toEqual(1);
expect(checkDbResult.data.findManyWebHook[0].operation).toEqual(
'createOneCompany',
expect(checkDbResult.data.webhook.operation).toEqual(
'company',
);
});
test('should succeed to unsubscribe', async () => {
@ -48,13 +47,13 @@ describe('triggers.company', () => {
requestDb(
z,
bundle,
`query findManyWebHook {findManyWebHook(where: {id: {equals: "${result.id}"}}){id}}`,
`query webhook {webhook(filter: {id: {eq: "${result.id}"}}){id}}`,
),
bundle,
);
expect(checkDbResult.data.findManyWebHook.length).toEqual(0);
expect(checkDbResult.data.webhook).toEqual(null);
});
test('should load company from web-hook', async () => {
test('should load company from webhook', async () => {
const bundle = {
cleanedRequest: {
id: 'd6ccb1d1-a90b-4822-a992-a0dd946592c9',
@ -85,6 +84,6 @@ describe('triggers.company', () => {
);
expect(results.length).toBeGreaterThan(1);
const firstCompany = results[0];
expect(firstCompany.id).toBeDefined();
expect(firstCompany.node.id).toBeDefined();
});
});