Skip to content

Commit dc0c5da

Browse files
committed
test: converted .then to async/await in batchUploader_2 test
1 parent 0ae657f commit dc0c5da

2 files changed

Lines changed: 6 additions & 9 deletions

File tree

test/src/tests-batchUploader.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1385,6 +1385,7 @@ describe('batch uploader', () => {
13851385
);
13861386
});
13871387

1388+
// http://go/j-SDKE-301
13881389
it('should save batches in sequence to Local Storage when upload is interrupted', async () => {
13891390
// Interruption in this context means that the first upload is successful, but
13901391
// the next upload in sequence is not. For example, on a mobile device on the
@@ -1519,6 +1520,7 @@ describe('batch uploader', () => {
15191520
).to.equal('application_state_transition');
15201521
});
15211522

1523+
// http://go/j-SDKE-301
15221524
it('should attempt to upload batches from Offline Storage before new batches', async () => {
15231525
// This test should verify that batches read from Offline Storage are prepended
15241526
// to the upload queue before newly created batches.

test/src/tests-batchUploader_2.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ describe('batch uploader', () => {
4444
fetchMock.restore();
4545
});
4646

47-
it('should organize events in the order they are processed and maintain that order when uploading', (done) => {
47+
it('should organize events in the order they are processed and maintain that order when uploading', async () => {
4848
// Batches should be uploaded in the order they were created to prevent
4949
// any potential corruption.
5050
fetchMock.post(urls.events, 200);
@@ -56,8 +56,9 @@ describe('batch uploader', () => {
5656

5757
window.mParticle._resetForTests(MPConfig);
5858
window.mParticle.init(apiKey, window.mParticle.config);
59-
waitForCondition(hasIdentifyReturned)
60-
.then(() => {
59+
60+
await waitForCondition(hasIdentifyReturned);
61+
6162
window.mParticle.logEvent('Test Event 0');
6263

6364
// Manually initiate the upload process - turn event into batches and upload the batch
@@ -108,12 +109,6 @@ describe('batch uploader', () => {
108109
expect(batch3.events.length).to.equal(2);
109110
expect(batch3.events[0].data.event_name).to.equal('Test Event 4');
110111
expect(batch3.events[1].data.event_name).to.equal('Test Event 5');
111-
112-
done();
113-
114-
})
115-
.catch((e) => {
116-
})
117112
});
118113

119114
// TODO: Investigate workflow with unshift vs push

0 commit comments

Comments
 (0)