|
2 | 2 | import {testEnv} from '@technote-space/github-action-test-helper';
|
3 | 3 | import {Utils} from '../src';
|
4 | 4 |
|
5 |
| -const {generateNewPatchVersion, generateNewMinorVersion, generateNewMajorVersion, arrayChunk, versionCompare, isCommandDebug, isOutputDebug, objectGet} = Utils; |
6 |
| -const {isBranch, isTagRef, normalizeRef, trimRef, getTag, getRefspec, getRemoteRefspec, getLocalRefspec, getOctokit, replaceVariables, mask, ensureNotNull} = Utils; |
| 5 | +const {generateNewPatchVersion, generateNewMinorVersion, generateNewMajorVersion, arrayChunk, versionCompare, isCommandDebug, isOutputDebug, objectGet, mask} = Utils; |
| 6 | +const {isBranch, isTagRef, normalizeRef, trimRef, getTag, getRefspec, getRemoteRefspec, getLocalRefspec, getOctokit, replaceVariables, ensureNotNullValue, ensureNotNull} = Utils; |
7 | 7 |
|
8 | 8 | jest.useFakeTimers();
|
9 | 9 |
|
@@ -320,6 +320,21 @@ describe('isOutputDebug', () => {
|
320 | 320 | });
|
321 | 321 | });
|
322 | 322 |
|
| 323 | +describe('ensureNotNullValue', () => { |
| 324 | + it('should return value', () => { |
| 325 | + expect(ensureNotNullValue('test', '')).toBe('test'); |
| 326 | + expect(ensureNotNullValue(true, false)).toBe(true); |
| 327 | + expect(ensureNotNullValue(1, 0)).toBe(1); |
| 328 | + }); |
| 329 | + |
| 330 | + it('should return default value', () => { |
| 331 | + expect(ensureNotNullValue(null, '')).toBe(''); |
| 332 | + expect(ensureNotNullValue(undefined, '')).toBe(''); |
| 333 | + expect(ensureNotNullValue(null, false)).toBe(false); |
| 334 | + expect(ensureNotNullValue(undefined, 3)).toBe(3); |
| 335 | + }); |
| 336 | +}); |
| 337 | + |
323 | 338 | describe('ensureNotNull', () => {
|
324 | 339 | it('should return value', () => {
|
325 | 340 | expect(ensureNotNull('test')).toBe('test');
|
|
0 commit comments