Skip to content

Commit c0c38e7

Browse files
committed
Added teardown and comments
1 parent 81f6f25 commit c0c38e7

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

tests/api-test.ts

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,22 @@ describe('EmailApi', function() {
88
var folder :string;
99
var storage = 'First Storage';
1010

11-
beforeAll(function() {
11+
beforeAll(async function() {
1212
api = new EmailApi(process.env.appSid, process.env.appKey, process.env.apiBaseUrl);
1313
folder = uuidv4();
1414
jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;
15+
await api.createFolder(new requests.CreateFolderRequest(folder, storage));
1516
})
1617

18+
afterAll(async function() {
19+
await api.deleteFolder(new requests.DeleteFolderRequest(folder, storage, true));
20+
})
21+
22+
/*
23+
* HierarchicalObject serialization and deserialization test.
24+
* This test checks that BaseObject.Type field filled automatically by SDK
25+
* and properly used in serialization and deserialization
26+
*/
1727
it('HierarchicalObject', async function() {
1828
var calendarFile = await createCalendar();
1929
var calendar = await api.getCalendar(new requests.GetCalendarRequest(calendarFile, folder, storage));
@@ -24,6 +34,9 @@ describe('EmailApi', function() {
2434
expect(primitive.value).toBeDefined();
2535
});
2636

37+
/**
38+
* Buffer support test
39+
*/
2740
it('FileTest', async function() {
2841
var calendarFile = await createCalendar();
2942
var path = folder + '/' + calendarFile;
@@ -39,6 +52,10 @@ describe('EmailApi', function() {
3952
expect(location.value).toEqual('location');
4053
});
4154

55+
/**
56+
* Contact format specified as Enum, but SDK represents it as an advanced type of string constants a string.
57+
* Test checks that value parsing works properly
58+
*/
4259
it('Contact format', async function() {
4360
for(var format of ['VCard', 'Msg']) {
4461
var extension = (format == 'Msg') ? '.msg' : '.vcf';
@@ -55,7 +72,12 @@ describe('EmailApi', function() {
5572
}
5673
});
5774

58-
it('Date and time', async function() {
75+
/**
76+
* Test Date serialization and deserialization.
77+
* Checks that SDK and Backend do not change Date during processing.
78+
* In most cases developer should carefully serialize and deserialize Date
79+
*/
80+
it('Date', async function() {
5981
var startDate = getDate(undefined, 24);
6082
startDate.setMilliseconds(0);
6183
var calendarFile = await createCalendar(startDate);

0 commit comments

Comments
 (0)