mirror of
https://gitlab.com/mobicoop/v3/service/matcher.git
synced 2026-01-01 08:22:41 +00:00
fix bad tests, fix invalid value object validations
This commit is contained in:
@@ -11,39 +11,31 @@ describe('Point value object', () => {
|
||||
expect(pointVO.lon).toBe(6.17651);
|
||||
});
|
||||
it('should throw an exception if longitude is invalid', () => {
|
||||
try {
|
||||
expect(() => {
|
||||
new Point({
|
||||
lat: 48.689445,
|
||||
lon: 186.17651,
|
||||
});
|
||||
} catch (e: any) {
|
||||
expect(e).toBeInstanceOf(ArgumentOutOfRangeException);
|
||||
}
|
||||
try {
|
||||
}).toThrow(ArgumentOutOfRangeException);
|
||||
expect(() => {
|
||||
new Point({
|
||||
lat: 48.689445,
|
||||
lon: -186.17651,
|
||||
});
|
||||
} catch (e: any) {
|
||||
expect(e).toBeInstanceOf(ArgumentOutOfRangeException);
|
||||
}
|
||||
}).toThrow(ArgumentOutOfRangeException);
|
||||
});
|
||||
it('should throw an exception if latitude is invalid', () => {
|
||||
try {
|
||||
expect(() => {
|
||||
new Point({
|
||||
lat: 148.689445,
|
||||
lon: 6.17651,
|
||||
});
|
||||
} catch (e: any) {
|
||||
expect(e).toBeInstanceOf(ArgumentOutOfRangeException);
|
||||
}
|
||||
try {
|
||||
}).toThrow(ArgumentOutOfRangeException);
|
||||
expect(() => {
|
||||
new Point({
|
||||
lat: -148.689445,
|
||||
lon: 6.17651,
|
||||
});
|
||||
} catch (e: any) {
|
||||
expect(e).toBeInstanceOf(ArgumentOutOfRangeException);
|
||||
}
|
||||
}).toThrow(ArgumentOutOfRangeException);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -18,71 +18,59 @@ describe('Step value object', () => {
|
||||
expect(stepVO.lon).toBe(6.17651);
|
||||
});
|
||||
it('should throw an exception if longitude is invalid', () => {
|
||||
try {
|
||||
expect(() => {
|
||||
new Step({
|
||||
lat: 48.689445,
|
||||
lon: 186.17651,
|
||||
duration: 150,
|
||||
distance: 12000,
|
||||
});
|
||||
} catch (e: any) {
|
||||
expect(e).toBeInstanceOf(ArgumentOutOfRangeException);
|
||||
}
|
||||
try {
|
||||
}).toThrow(ArgumentOutOfRangeException);
|
||||
expect(() => {
|
||||
new Step({
|
||||
lon: 48.689445,
|
||||
lat: -186.17651,
|
||||
lat: 48.689445,
|
||||
lon: -186.17651,
|
||||
duration: 150,
|
||||
distance: 12000,
|
||||
});
|
||||
} catch (e: any) {
|
||||
expect(e).toBeInstanceOf(ArgumentOutOfRangeException);
|
||||
}
|
||||
}).toThrow(ArgumentOutOfRangeException);
|
||||
});
|
||||
it('should throw an exception if latitude is invalid', () => {
|
||||
try {
|
||||
expect(() => {
|
||||
new Step({
|
||||
lat: 248.689445,
|
||||
lon: 6.17651,
|
||||
duration: 150,
|
||||
distance: 12000,
|
||||
});
|
||||
} catch (e: any) {
|
||||
expect(e).toBeInstanceOf(ArgumentOutOfRangeException);
|
||||
}
|
||||
try {
|
||||
}).toThrow(ArgumentOutOfRangeException);
|
||||
expect(() => {
|
||||
new Step({
|
||||
lon: -148.689445,
|
||||
lat: 6.17651,
|
||||
lat: -148.689445,
|
||||
lon: 6.17651,
|
||||
duration: 150,
|
||||
distance: 12000,
|
||||
});
|
||||
} catch (e: any) {
|
||||
expect(e).toBeInstanceOf(ArgumentOutOfRangeException);
|
||||
}
|
||||
}).toThrow(ArgumentOutOfRangeException);
|
||||
});
|
||||
it('should throw an exception if distance is invalid', () => {
|
||||
try {
|
||||
expect(() => {
|
||||
new Step({
|
||||
lat: 48.689445,
|
||||
lon: 6.17651,
|
||||
duration: 150,
|
||||
distance: -12000,
|
||||
});
|
||||
} catch (e: any) {
|
||||
expect(e).toBeInstanceOf(ArgumentInvalidException);
|
||||
}
|
||||
}).toThrow(ArgumentInvalidException);
|
||||
});
|
||||
it('should throw an exception if duration is invalid', () => {
|
||||
try {
|
||||
expect(() => {
|
||||
new Step({
|
||||
lat: 48.689445,
|
||||
lon: 6.17651,
|
||||
duration: -150,
|
||||
distance: 12000,
|
||||
});
|
||||
} catch (e: any) {
|
||||
expect(e).toBeInstanceOf(ArgumentInvalidException);
|
||||
}
|
||||
}).toThrow(ArgumentInvalidException);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user