@squiz/db-lib 1.2.1-alpha.98 → 1.2.1-alpha.99
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +8 -0
- package/lib/index.d.ts +0 -7
- package/lib/index.js +0 -114
- package/lib/index.js.map +4 -4
- package/package.json +4 -5
- package/src/index.ts +0 -11
- package/tsconfig.tsbuildinfo +1 -1
- package/lib/assertions/assertAssign.d.ts +0 -4
- package/lib/assertions/assertAssign.spec.d.ts +0 -1
- package/lib/assertions/assertAssignWithDefaultUndefinedValue.d.ts +0 -4
- package/lib/assertions/assertAssignWithDefaultUndefinedValue.spec.d.ts +0 -1
- package/lib/assertions/assertIsDefined.d.ts +0 -1
- package/lib/assertions/assertIsDefined.spec.d.ts +0 -1
- package/lib/assertions/assertIsMapOfStringString.d.ts +0 -3
- package/lib/assertions/assertIsMapOfStringString.spec.d.ts +0 -1
- package/lib/assertions/assertIsNotAnEmptyString.d.ts +0 -1
- package/lib/assertions/assertIsNotAnEmptyString.spec.d.ts +0 -1
- package/lib/assertions/assertIsObject.d.ts +0 -1
- package/lib/assertions/assertIsObject.spec.d.ts +0 -1
- package/lib/assertions/assertIsString.d.ts +0 -1
- package/lib/assertions/assertIsString.spec.d.ts +0 -1
- package/src/assertions/assertAssign.spec.ts +0 -18
- package/src/assertions/assertAssign.ts +0 -22
- package/src/assertions/assertAssignWithDefaultUndefinedValue.spec.ts +0 -31
- package/src/assertions/assertAssignWithDefaultUndefinedValue.ts +0 -17
- package/src/assertions/assertIsDefined.spec.ts +0 -19
- package/src/assertions/assertIsDefined.ts +0 -7
- package/src/assertions/assertIsMapOfStringString.spec.ts +0 -23
- package/src/assertions/assertIsMapOfStringString.ts +0 -29
- package/src/assertions/assertIsNotAnEmptyString.spec.ts +0 -25
- package/src/assertions/assertIsNotAnEmptyString.ts +0 -17
- package/src/assertions/assertIsObject.spec.ts +0 -17
- package/src/assertions/assertIsObject.ts +0 -11
- package/src/assertions/assertIsString.spec.ts +0 -16
- package/src/assertions/assertIsString.ts +0 -11
@@ -1,16 +0,0 @@
|
|
1
|
-
import { assertIsString } from './assertIsString';
|
2
|
-
|
3
|
-
describe('assertIsString', () => {
|
4
|
-
it('should not throw if input is a string', () => {
|
5
|
-
expect(assertIsString('hello')).toBeUndefined();
|
6
|
-
});
|
7
|
-
|
8
|
-
it('should not throw if input is not a string', () => {
|
9
|
-
expect(() => assertIsString(undefined)).toThrowErrorMatchingInlineSnapshot(`"value is not a string"`);
|
10
|
-
expect(() => assertIsString(null)).toThrowErrorMatchingInlineSnapshot(`"value is not a string"`);
|
11
|
-
expect(() => assertIsString(123)).toThrowErrorMatchingInlineSnapshot(`"value is not a string"`);
|
12
|
-
expect(() => assertIsString([])).toThrowErrorMatchingInlineSnapshot(`"value is not a string"`);
|
13
|
-
expect(() => assertIsString(NaN)).toThrowErrorMatchingInlineSnapshot(`"value is not a string"`);
|
14
|
-
expect(() => assertIsString(Infinity)).toThrowErrorMatchingInlineSnapshot(`"value is not a string"`);
|
15
|
-
});
|
16
|
-
});
|
@@ -1,11 +0,0 @@
|
|
1
|
-
import { AssertionError } from 'assert';
|
2
|
-
|
3
|
-
export function assertIsString(val: any): asserts val is string {
|
4
|
-
if (typeof val !== 'string') {
|
5
|
-
throw new AssertionError({
|
6
|
-
actual: val,
|
7
|
-
expected: 'string',
|
8
|
-
message: 'value is not a string',
|
9
|
-
});
|
10
|
-
}
|
11
|
-
}
|