Skip to content

Commit 53b1d2e

Browse files
committed
Refactor isUserAttributes tests to use getAllFieldCombinations
1 parent 4be3a1b commit 53b1d2e

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

types/user-attributes.test.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { describe, it } from 'jsr:@std/testing/bdd'
22
import { expect } from 'jsr:@std/expect'
3+
import getAllFieldCombinations from '../utils/testing/get-all-field-combinations.ts'
34
import { isUserAttributes } from './user-attributes.ts'
45

56
describe('isUserAttributes', () => {
@@ -14,10 +15,10 @@ describe('isUserAttributes', () => {
1415
})
1516

1617
it('returns true if given a UserAttributes object', () => {
17-
expect(isUserAttributes({})).toBe(true)
18-
expect(isUserAttributes({ name })).toBe(true)
19-
expect(isUserAttributes({ username })).toBe(true)
20-
expect(isUserAttributes({ name, username })).toBe(true)
18+
const objects = getAllFieldCombinations({ name, username })
19+
for (const object of objects) {
20+
expect(isUserAttributes(object)).toBe(true)
21+
}
2122
})
2223

2324
it('returns false if the object has additional properties', () => {

0 commit comments

Comments
 (0)