Skip to content

Commit 5fef7f1

Browse files
committed
Issue #33: Add failing data type test for mergeIssueToPRs.
1 parent 348cec7 commit 5fef7f1

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

spec/contentScript/github/githubStore.spec.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,25 @@ describe('A GithubStore', () => {
177177
expect(backingData[key] <= after).toBeTruthy();
178178
});
179179
});
180+
181+
it('WHEN storing data THEN that data is primitive or an array', async () => {
182+
function isValidDataFormat(value: any): boolean {
183+
const type = typeof value;
184+
const isPrimitive = type === "string" || type === "number" || type === "boolean";
185+
const isArray = Array.isArray(value);
186+
return isPrimitive || isArray;
187+
}
188+
189+
await testStore.mergeIssueToPRs({
190+
4: new Set([1, 20]),
191+
12: new Set([487, 360, 20])
192+
});
193+
194+
Object.keys(backingData).forEach(key => {
195+
const value = backingData[key];
196+
expect(isValidDataFormat(value)).toBeTruthy(`but received ${value} with type ${typeof value}`);
197+
})
198+
});
180199
});
181200

182201
it('given a PR last update millis in the DB, will get it', async () => {

0 commit comments

Comments
 (0)