Add no-misused/floating-promises lint rule
This commit is contained in:
parent
1a68c3db62
commit
ed271d92ea
150 changed files with 1296 additions and 991 deletions
|
@ -17,8 +17,8 @@ describe('RetryPlaceholders', () => {
|
|||
const NOW = 1_000_000;
|
||||
let clock: any;
|
||||
|
||||
beforeEach(() => {
|
||||
window.storage.put(STORAGE_KEY, undefined as any);
|
||||
beforeEach(async () => {
|
||||
await window.storage.put(STORAGE_KEY, undefined as any);
|
||||
|
||||
clock = sinon.useFakeTimers({
|
||||
now: NOW,
|
||||
|
@ -40,19 +40,19 @@ describe('RetryPlaceholders', () => {
|
|||
}
|
||||
|
||||
describe('constructor', () => {
|
||||
it('loads previously-saved data on creation', () => {
|
||||
it('loads previously-saved data on creation', async () => {
|
||||
const items: Array<RetryItemType> = [
|
||||
getDefaultItem(),
|
||||
{ ...getDefaultItem(), conversationId: 'conversation-id-2' },
|
||||
];
|
||||
window.storage.put(STORAGE_KEY, items);
|
||||
await window.storage.put(STORAGE_KEY, items);
|
||||
|
||||
const placeholders = new RetryPlaceholders();
|
||||
|
||||
assert.strictEqual(2, placeholders.getCount());
|
||||
});
|
||||
it('starts with no data if provided data fails to parse', () => {
|
||||
window.storage.put(STORAGE_KEY, [
|
||||
it('starts with no data if provided data fails to parse', async () => {
|
||||
await window.storage.put(STORAGE_KEY, [
|
||||
{ item: 'is wrong shape!' },
|
||||
{ bad: 'is not good!' },
|
||||
] as any);
|
||||
|
@ -70,9 +70,9 @@ describe('RetryPlaceholders', () => {
|
|||
assert.strictEqual(1, placeholders.getCount());
|
||||
});
|
||||
|
||||
it('throws if provided data fails to parse', () => {
|
||||
it('throws if provided data fails to parse', async () => {
|
||||
const placeholders = new RetryPlaceholders();
|
||||
assert.isRejected(
|
||||
await assert.isRejected(
|
||||
placeholders.add({
|
||||
item: 'is wrong shape!',
|
||||
} as any),
|
||||
|
@ -87,10 +87,10 @@ describe('RetryPlaceholders', () => {
|
|||
assert.strictEqual(0, placeholders.getCount());
|
||||
assert.isUndefined(placeholders.getNextToExpire());
|
||||
});
|
||||
it('returns only item if just one item', () => {
|
||||
it('returns only item if just one item', async () => {
|
||||
const item = getDefaultItem();
|
||||
const items: Array<RetryItemType> = [item];
|
||||
window.storage.put(STORAGE_KEY, items);
|
||||
await window.storage.put(STORAGE_KEY, items);
|
||||
|
||||
const placeholders = new RetryPlaceholders();
|
||||
assert.strictEqual(1, placeholders.getCount());
|
||||
|
@ -106,7 +106,7 @@ describe('RetryPlaceholders', () => {
|
|||
receivedAt: NOW + 10,
|
||||
};
|
||||
const items: Array<RetryItemType> = [older, newer];
|
||||
window.storage.put(STORAGE_KEY, items);
|
||||
await window.storage.put(STORAGE_KEY, items);
|
||||
|
||||
const placeholders = new RetryPlaceholders();
|
||||
assert.strictEqual(2, placeholders.getCount());
|
||||
|
@ -134,7 +134,7 @@ describe('RetryPlaceholders', () => {
|
|||
receivedAt: NOW + 15,
|
||||
};
|
||||
const items: Array<RetryItemType> = [older, newer];
|
||||
window.storage.put(STORAGE_KEY, items);
|
||||
await window.storage.put(STORAGE_KEY, items);
|
||||
|
||||
const placeholders = new RetryPlaceholders();
|
||||
assert.strictEqual(2, placeholders.getCount());
|
||||
|
@ -151,7 +151,7 @@ describe('RetryPlaceholders', () => {
|
|||
receivedAt: NOW + 15,
|
||||
};
|
||||
const items: Array<RetryItemType> = [older, newer];
|
||||
window.storage.put(STORAGE_KEY, items);
|
||||
await window.storage.put(STORAGE_KEY, items);
|
||||
|
||||
const placeholders = new RetryPlaceholders();
|
||||
assert.strictEqual(2, placeholders.getCount());
|
||||
|
@ -169,7 +169,7 @@ describe('RetryPlaceholders', () => {
|
|||
receivedAt: getDeltaIntoPast() - 900,
|
||||
};
|
||||
const items: Array<RetryItemType> = [older, newer];
|
||||
window.storage.put(STORAGE_KEY, items);
|
||||
await window.storage.put(STORAGE_KEY, items);
|
||||
|
||||
const placeholders = new RetryPlaceholders();
|
||||
assert.strictEqual(2, placeholders.getCount());
|
||||
|
@ -192,7 +192,7 @@ describe('RetryPlaceholders', () => {
|
|||
conversationId: 'conversation-id-2',
|
||||
};
|
||||
const items: Array<RetryItemType> = [older, newer];
|
||||
window.storage.put(STORAGE_KEY, items);
|
||||
await window.storage.put(STORAGE_KEY, items);
|
||||
|
||||
const placeholders = new RetryPlaceholders();
|
||||
assert.strictEqual(2, placeholders.getCount());
|
||||
|
@ -219,7 +219,7 @@ describe('RetryPlaceholders', () => {
|
|||
receivedAt: NOW + 15,
|
||||
};
|
||||
const items: Array<RetryItemType> = [convo1a, convo1b, convo2a];
|
||||
window.storage.put(STORAGE_KEY, items);
|
||||
await window.storage.put(STORAGE_KEY, items);
|
||||
|
||||
const placeholders = new RetryPlaceholders();
|
||||
assert.strictEqual(3, placeholders.getCount());
|
||||
|
@ -293,7 +293,7 @@ describe('RetryPlaceholders', () => {
|
|||
sentAt: NOW - 11,
|
||||
};
|
||||
const items: Array<RetryItemType> = [older, newer];
|
||||
window.storage.put(STORAGE_KEY, items);
|
||||
await window.storage.put(STORAGE_KEY, items);
|
||||
|
||||
const placeholders = new RetryPlaceholders();
|
||||
assert.strictEqual(2, placeholders.getCount());
|
||||
|
@ -316,7 +316,7 @@ describe('RetryPlaceholders', () => {
|
|||
sentAt,
|
||||
};
|
||||
const items: Array<RetryItemType> = [older, newer];
|
||||
window.storage.put(STORAGE_KEY, items);
|
||||
await window.storage.put(STORAGE_KEY, items);
|
||||
|
||||
const placeholders = new RetryPlaceholders();
|
||||
assert.strictEqual(2, placeholders.getCount());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue