Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaslagoni committed Mar 5, 2024
1 parent 1819b52 commit 321df0a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
9 changes: 8 additions & 1 deletion test/generators/python/PythonConstrainer.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,18 @@ describe('PythonConstrainer', () => {
describe('Any', () => {
test('should render type', () => {
const model = new ConstrainedAnyModel('test', undefined, {}, '');
const dependencyManager = new PythonDependencyManager(
PythonGenerator.defaultOptions
);
const type = PythonDefaultTypeMapping.Any({
constrainedModel: model,
...defaultOptions
...defaultOptions,
dependencyManager
});
expect(type).toEqual('Any');
expect(dependencyManager.dependencies).toEqual([
'from typing import Any'
]);
});
});
describe('Float', () => {
Expand Down
4 changes: 0 additions & 4 deletions test/generators/python/PythonGenerator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,10 @@ describe('PythonGenerator', () => {
}
]
});
const expectedDependencies: string[] = [];

const models = await generator.generate(doc);
expect(models).toHaveLength(1);
expect(models[0].result).toMatchSnapshot();
expect(models[0].dependencies).toEqual(expectedDependencies);
});
test('should work with empty objects', async () => {
const doc = {
Expand All @@ -145,12 +143,10 @@ describe('PythonGenerator', () => {
additionalProperties: false
};
generator = new PythonGenerator();
const expectedDependencies: string[] = [];

const models = await generator.generate(doc);
expect(models).toHaveLength(1);
expect(models[0].result).toMatchSnapshot();
expect(models[0].dependencies).toEqual(expectedDependencies);
});
});
});

0 comments on commit 321df0a

Please sign in to comment.