-
Notifications
You must be signed in to change notification settings - Fork 392
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
Showing
5 changed files
with
39 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* CloudBeaver - Cloud Database Manager | ||
* Copyright (C) 2020-2024 DBeaver Corp and others | ||
* | ||
* Licensed under the Apache License, Version 2.0. | ||
* you may not use this file except in compliance with the License. | ||
*/ | ||
import { describe, expect, test } from '@jest/globals'; | ||
|
||
import { isNumber } from './isNumber.js'; | ||
|
||
describe('isNumber', () => { | ||
test('returns true for valid numbers', () => { | ||
expect(isNumber(123)).toBe(true); | ||
expect(isNumber(123.45)).toBe(true); | ||
expect(isNumber('123')).toBe(true); | ||
expect(isNumber('123.45')).toBe(true); | ||
expect(isNumber(0)).toBe(true); | ||
}); | ||
|
||
test('returns false for non-numeric strings', () => { | ||
expect(isNumber('hello')).toBe(false); | ||
expect(isNumber('123abc')).toBe(false); | ||
expect(isNumber('')).toBe(false); | ||
}); | ||
|
||
test('returns false for non-numeric values', () => { | ||
expect(isNumber(NaN)).toBe(false); | ||
expect(isNumber(Infinity)).toBe(false); | ||
expect(isNumber(-Infinity)).toBe(false); | ||
expect(isNumber(null)).toBe(false); | ||
expect(isNumber(undefined)).toBe(false); | ||
expect(isNumber({})).toBe(false); | ||
expect(isNumber([])).toBe(false); | ||
expect(isNumber(true)).toBe(false); | ||
expect(isNumber(false)).toBe(false); | ||
}); | ||
}); |
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