-
Notifications
You must be signed in to change notification settings - Fork 612
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6dcbbd2
commit 38b459c
Showing
12 changed files
with
305 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
frontend/packages/topology/src/components/utils/__tests__/CheckResourceQuota.spec.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { checkQuotaLimit } from '../checkResourceQuota'; | ||
import { | ||
singleResourceQuota, | ||
multipleResourceQuota, | ||
noResourceAtQuota, | ||
twoResourceAtQuota, | ||
} from './mockData'; | ||
|
||
describe('get resources at quota', () => { | ||
it('should return one resource at quota', () => { | ||
const [totalRQatQuota = [], quotaName, quotaKind] = checkQuotaLimit(singleResourceQuota); | ||
expect(totalRQatQuota.length).toEqual(1); | ||
expect(quotaName).toEqual('example'); | ||
expect(quotaKind).toEqual('ResourceQuota'); | ||
}); | ||
|
||
it('should return one resource at quota out of two resource quotas', () => { | ||
const [totalRQsatQuota = [], quotaName, quotaKind] = checkQuotaLimit(multipleResourceQuota); | ||
const totalRQatQuota = totalRQsatQuota.filter((resourceAtQuota) => resourceAtQuota !== 0); | ||
expect(totalRQatQuota.length).toEqual(1); | ||
expect(quotaName).toEqual('example'); | ||
expect(quotaKind).toEqual('ResourceQuota'); | ||
}); | ||
|
||
it('should return no resource at quota', () => { | ||
const [totalRQsatQuota = [], quotaName, quotaKind] = checkQuotaLimit(noResourceAtQuota); | ||
const totalRQatQuota = totalRQsatQuota.filter((resourceAtQuota) => resourceAtQuota !== 0); | ||
expect(totalRQatQuota.length).toEqual(0); | ||
expect(quotaName).toEqual(''); | ||
expect(quotaKind).toEqual(''); | ||
}); | ||
|
||
it('should return two resource at quota', () => { | ||
let [totalRQatQuota = []] = checkQuotaLimit(twoResourceAtQuota); | ||
totalRQatQuota = totalRQatQuota.filter((resourceAtQuota) => resourceAtQuota !== 0); | ||
expect(totalRQatQuota.length).toEqual(2); | ||
}); | ||
}); |
Oops, something went wrong.