Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers 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

r.row is not defined in this context #25

Open
Sven65 opened this issue May 22, 2021 · 0 comments
Open

r.row is not defined in this context #25

Sven65 opened this issue May 22, 2021 · 0 comments

Comments

@Sven65
Copy link

Sven65 commented May 22, 2021

Describe the problem

Using r.row() in this query results in error

I've got the following function which I'm testing using this library and jest.

async addPlayerKills(kills: number): Promise<any> {
	return await r.table('users').get(this.user.id).update({
		playerkills: r.row('playerkills').default(0).add(kills),
	})
}

To test it, I'm using the following block:

test('Should add player kills', async () => {
	await user.addPlayerKills(1)

	const userData = await user.get()

	expect(userData?.playerkills).toBe(1)
})

But instead of getting any data, I get the error r.row is not defined in this context, from the line at https://github.com/aleclarson/rethinkdb-mock/blob/master/src/Query.coffee#L316

The user.get() method is just a simple call to r.table('users').get()

Environment:

Jest: 26.6.3
Rethinkdb-Mock: 0.7.1
Node: 14.17.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant