Skip to content

Commit

Permalink
Fix constants tests
Browse files Browse the repository at this point in the history
  • Loading branch information
thekevinscott committed Nov 21, 2023
1 parent 68860d6 commit d7bbf8c
Showing 1 changed file with 0 additions and 27 deletions.
27 changes: 0 additions & 27 deletions packages/shared/src/constants.test.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
import * as tf from '@tensorflow/tfjs-node';
import { vi } from 'vitest';
import {
ModelDefinition,
MODEL_DEFINITION_VALIDATION_CHECK_ERROR_TYPE,
} from './types';
import {
makeIsNDimensionalTensor,
isFourDimensionalTensor,
isThreeDimensionalTensor,
isTensor,
isString,
checkModelDefinition,
hasValidChannels,
isValidRange,
isNumber,
Expand Down Expand Up @@ -90,28 +85,6 @@ describe('isString', () => {
});
});

describe('isValidModelDefinition', () => {
it('throws error if given an undefined', () => {
expect(() => checkModelDefinition(undefined)).toThrow(MODEL_DEFINITION_VALIDATION_CHECK_ERROR_TYPE.UNDEFINED);
});

it('throws error if given no path', () => {
expect(() => checkModelDefinition({ path: undefined, scale: 2 } as unknown as ModelDefinition)).toThrow(MODEL_DEFINITION_VALIDATION_CHECK_ERROR_TYPE.MISSING_PATH);
});

it('throws error if given invalid model type', () => {
expect(() => checkModelDefinition({ path: 'foo', scale: 2, modelType: 'foo' } as unknown as ModelDefinition)).toThrow(MODEL_DEFINITION_VALIDATION_CHECK_ERROR_TYPE.INVALID_MODEL_TYPE);
});

it('returns true if given scale and path', () => {
expect(checkModelDefinition({
path: 'foo',
scale: 2,
modelType: 'layers',
})).toEqual(true);
});
});

describe('hasValidChannels', () => {
it('returns true if a tensor has valid channels', () => {
expect(hasValidChannels(tf.ones([4, 4, 3]))).toEqual(true);
Expand Down

0 comments on commit d7bbf8c

Please sign in to comment.