Skip to content

Fix 'entity' typo #240

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion src/entity-factory.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('make', () => {
expect(newUser.name).toBe('Steve')
})

test('Should override the enitys props', async () => {
test('Should override the entity props', async () => {
const mockUserFactory = jest.fn()
const userFactory = new EntityFactory('User', User, mockUserFactory)
mockUserFactory.mockReturnValue(new User('Steve'))
Expand Down
6 changes: 3 additions & 3 deletions src/entity-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export class EntityFactory<Entity, Context> {
* Make a new entity, but does not persist it
*/
public async make(overrideParams: EntityProperty<Entity> = {}): Promise<Entity> {
return this.makeEnity(overrideParams, false)
return this.makeEntity(overrideParams, false)
}

/**
Expand All @@ -44,7 +44,7 @@ export class EntityFactory<Entity, Context> {
if (connection && connection.isConnected) {
const em = connection.createEntityManager()
try {
const entity = await this.makeEnity(overrideParams, true)
const entity = await this.makeEntity(overrideParams, true)
return await em.save<Entity>(entity, saveOptions)
} catch (error) {
const message = 'Could not save entity'
Expand Down Expand Up @@ -92,7 +92,7 @@ export class EntityFactory<Entity, Context> {
// Private Helpers
// -------------------------------------------------------------------------

private async makeEnity(overrideParams: EntityProperty<Entity> = {}, isSeeding = false): Promise<Entity> {
private async makeEntity(overrideParams: EntityProperty<Entity> = {}, isSeeding = false): Promise<Entity> {
if (!this.factory) {
throw new Error('Could not found entity')
}
Expand Down
8 changes: 4 additions & 4 deletions src/utils/factory.test.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { getNameOfEntity, isPromiseLike } from './factory.util'

describe('getNameOfClass', () => {
test('Passing UserEnity class should return the name of the class', () => {
test('Passing UserEntity class should return the name of the class', () => {
class UserEntity {}
expect(getNameOfEntity(UserEntity)).toBe('UserEntity')
})
test('Passing UserEnity function should return the name of the function', () => {
test('Passing UserEntity function should return the name of the function', () => {
const UserEntity = (): any => void 0
expect(getNameOfEntity(UserEntity)).toBe('UserEntity')
})
test('Passing undefinde as a enity-class should throw an error', () => {
test('Passing undefinde as a entity-class should throw an error', () => {
try {
getNameOfEntity(undefined)
} catch (error) {
expect(error.message).toBe('Enity is not defined')
expect(error.message).toBe('Entity is not defined')
}
})
})
Expand Down
2 changes: 1 addition & 1 deletion src/utils/factory.util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const getNameOfEntity = <T>(entity: ObjectType<T>): string => {
} else if (entity) {
return new (entity as any)().constructor.name
}
throw new Error('Enity is not defined')
throw new Error('Entity is not defined')
}

export const isPromiseLike = (o: any): boolean =>
Expand Down