8000 add test to make sure different names won't collapse to same alias by nicoabie · Pull Request #530 · join-monster/join-monster · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

add test to make sure different names won't collapse to same alias #530

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its m 8000 aintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
### vNEXT
#### Fixed
- [#530](https://github.com/join-monster/join-monster/pull/530): Add test to make sure different names won't collapse to same alias.
- [#525](https://github.com/join-monster/join-monster/pull/525): Fix readthedocs deploys.
- [#526](https://github.com/join-monster/join-monster/pull/526): Warns when alias length is exceeded for what postgres allows.
- [#523](https://github.com/join-monster/join-monster/pull/523): Make demo runnable again.
Expand Down
6 changes: 6 additions & 0 deletions test/alias-namespace.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@
t.is(ns.generate('column', 'firstname'), 'firstname')
})

test(`it should generate an unminified table alias (diffenent names won't collapse to alias)`, t => {
const ns = new AliasNamespace(false)
t.is(ns.generate('table', 'InformationItem'), 'Informatio')
t.is(ns.generate('table', 'InformationItemHasGroup'), 'Informatio$')
})

if (process.env.DB === 'PG' && !process.env.STRATEGY && !process.env.MINIFY) {
test('it should warn when alias in longer than dialect can accept', async t => {
const spy = sinon.spy(console, 'warn')
Expand All @@ -55,6 +61,6 @@
}
`
await graphql({schema, source})
t.assert(spy.calledWith('Alias length exceeds the max allowed length of 63 characters for pg: upper("author$"."last_name") AS "comments__post__author__following__posts__author$__capitalizedLastName"'))

Check warning on line 64 in test/alias-namespace.js

View workflow job for this annotation

GitHub Actions / ESLint

test/alias-namespace.js#L64

This line has a length of 205. Maximum allowed is 125 (max-len)
})
}
Loading
0