feat: add integration tests for queryRecords and deleteRecordsByIds methods. fix: implemented deleteRecordsByIds method and wrote unit tests

This commit is contained in:
StevanFreeborn
2023-02-19 23:55:47 -06:00
parent 9c44efe567
commit 3bf65f24d9
6 changed files with 503 additions and 105 deletions
+33
View File
@@ -0,0 +1,33 @@
import { OnspringClient, Record, StringRecordValue } from '../../src';
import { expect } from 'chai';
async function addRecord(
baseURL: string | undefined,
apiKey: string | undefined
): Promise<number> {
const client = new OnspringClient(baseURL, apiKey);
if (process.env.TEST_SURVEY_ID === undefined) {
expect.fail('TEST_SURVEY_ID is not defined');
}
if (process.env.TEST_TEXT_FIELD === undefined) {
expect.fail('TEST_TEXT_FIELD is not defined');
}
const request = new Record(parseInt(process.env.TEST_SURVEY_ID), null);
request.addValue(
new StringRecordValue(parseInt(process.env.TEST_TEXT_FIELD), 'test')
);
const response = await client.saveRecord(request);
if (response.data === null || response.data.id === undefined) {
expect.fail('Record ID is not defined');
}
return response.data.id;
}
export { addRecord };