Skip to content

Commit

Permalink
fix getCypherConstraints without constraints
Browse files Browse the repository at this point in the history
  • Loading branch information
ciminf committed Jul 13, 2022
1 parent 61e91f6 commit be5a04a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/storage/neo4j.metadata.storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ export class Neo4jMetadataStorageDef {
}
}

getCypherConstraints(label?: string) {
getCypherConstraints(label?: string): string[] {
if (label) {
return this._cypherConstraints.get(label);
return this._cypherConstraints.get(label) || [];
} else {
return ([] as string[]).concat(
...Array.from(this._cypherConstraints.values()),
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nhogs/nestjs-neo4j",
"version": "0.5.3",
"version": "0.5.4",
"engines": {
"node": ">=16.x"
},
Expand Down
6 changes: 6 additions & 0 deletions spec/unit/service/neo4j-model-service-.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,12 @@ describe('Neo4jModelService', () => {
).toEqual(props);
});

it('should runCypherConstraints without constraints', async () => {
expect(await serviceFixture.runCypherConstraints()).toMatchInlineSnapshot(
`Array []`,
);
});

afterAll(async () => {
return await app.cleanClose();
});
Expand Down

0 comments on commit be5a04a

Please sign in to comment.