Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(tests): [nan-2498] failing tests #189

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions integrations/gorgias/tests/gorgias-create-ticket.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { vi, expect, it, describe } from 'vitest';

import runAction from '../actions/create-ticket.js';

describe('gorgias create-ticket tests', () => {
const nangoMock = new global.vitest.NangoActionMock({
dirname: __dirname,
name: 'create-ticket',
Model: 'Ticket'
});

it('should output the action output that is expected', async () => {
const input = await nangoMock.getInput();
const response = await runAction(nangoMock, input);
const output = await nangoMock.getOutput();

expect(response).toEqual(output);
});
});
19 changes: 19 additions & 0 deletions integrations/lever/tests/lever-get-posting.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { vi, expect, it, describe } from 'vitest';

import runAction from '../actions/get-posting.js';

describe('lever get-posting tests', () => {
const nangoMock = new global.vitest.NangoActionMock({
dirname: __dirname,
name: 'get-posting',
Model: 'SuccessResponse'
});

it('should output the action output that is expected', async () => {
const input = await nangoMock.getInput();
const response = await runAction(nangoMock, input);
const output = await nangoMock.getOutput();

expect(response).toEqual(output);
});
});
19 changes: 19 additions & 0 deletions integrations/linear/tests/linear-create-issue.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { vi, expect, it, describe } from 'vitest';

import runAction from '../actions/create-issue.js';

describe('linear create-issue tests', () => {
const nangoMock = new global.vitest.NangoActionMock({
dirname: __dirname,
name: 'create-issue',
Model: 'LinearIssue'
});

it('should output the action output that is expected', async () => {
const input = await nangoMock.getInput();
const response = await runAction(nangoMock, input);
const output = await nangoMock.getOutput();

expect(response).toEqual(output);
});
});
19 changes: 19 additions & 0 deletions integrations/smartsheet/tests/smartsheet-create-user.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { vi, expect, it, describe } from 'vitest';

import runAction from '../actions/create-user.js';

describe('smartsheet create-user tests', () => {
const nangoMock = new global.vitest.NangoActionMock({
dirname: __dirname,
name: 'create-user',
Model: 'User'
});

it('should output the action output that is expected', async () => {
const input = await nangoMock.getInput();
const response = await runAction(nangoMock, input);
const output = await nangoMock.getOutput();

expect(response).toEqual(output);
});
});
45 changes: 45 additions & 0 deletions integrations/xero/tests/xero-general-ledger.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { vi, expect, it, describe } from 'vitest';

import fetchData from '../syncs/general-ledger.js';

describe('xero general-ledger tests', () => {
const nangoMock = new global.vitest.NangoSyncMock({
dirname: __dirname,
name: 'general-ledger',
Model: 'GeneralLedger'
});

const models = 'GeneralLedger'.split(',');
const batchSaveSpy = vi.spyOn(nangoMock, 'batchSave');

it('should get, map correctly the data and batchSave the result', async () => {
await fetchData(nangoMock);

for (const model of models) {
const expectedBatchSaveData = await nangoMock.getBatchSaveData(model);

const spiedData = batchSaveSpy.mock.calls.flatMap((call) => {
if (call[1] === model) {
return call[0];
}

return [];
});

const spied = JSON.parse(JSON.stringify(spiedData));

expect(spied).toStrictEqual(expectedBatchSaveData);
}
});

it('should get, map correctly the data and batchDelete the result', async () => {
await fetchData(nangoMock);

for (const model of models) {
const batchDeleteData = await nangoMock.getBatchDeleteData(model);
if (batchDeleteData && batchDeleteData.length > 0) {
expect(nangoMock.batchDelete).toHaveBeenCalledWith(batchDeleteData, model);
}
}
});
});
58 changes: 23 additions & 35 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading