Skip to content

Commit

Permalink
fix: Avoid testing with exact-threshold value
Browse files Browse the repository at this point in the history
  • Loading branch information
miyanokomiya committed Nov 24, 2024
1 parent 0442e9d commit 6b4da4a
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions src/composables/shapeSnapping.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -408,10 +408,10 @@ describe("newShapeIntervalSnapping", () => {
const target = newShapeIntervalSnapping({ shapeSnappingList: [shapeSnappingList[0], shapeSnappingList[1]] });

test("x snapping: should return snapping result", () => {
expect(target.test({ x: -70, y: 0, width: 10, height: 10 }), "left side").toEqual({
expect(target.test({ x: -68, y: 0, width: 10, height: 10 }), "left side").toEqual({
v: {
d: 10,
ad: 10,
d: 8,
ad: 8,
target: {
direction: "v",
beforeId: "a",
Expand All @@ -430,10 +430,10 @@ describe("newShapeIntervalSnapping", () => {
},
});

expect(target.test({ x: 310, y: 0, width: 10, height: 10 }), "right side").toEqual({
expect(target.test({ x: 308, y: 0, width: 10, height: 10 }), "right side").toEqual({
v: {
d: -10,
ad: 10,
d: -8,
ad: 8,
target: {
direction: "v",
beforeId: "a",
Expand All @@ -452,10 +452,10 @@ describe("newShapeIntervalSnapping", () => {
},
});

expect(target.test({ x: 110, y: 0, width: 10, height: 10 }), "between").toEqual({
expect(target.test({ x: 112, y: 0, width: 10, height: 10 }), "between").toEqual({
v: {
d: 10,
ad: 10,
d: 8,
ad: 8,
target: {
direction: "v",
beforeId: "a",
Expand All @@ -474,10 +474,10 @@ describe("newShapeIntervalSnapping", () => {
},
});

expect(target.test({ x: 130, y: 0, width: 10, height: 10 }), "between").toEqual({
expect(target.test({ x: 127, y: 0, width: 10, height: 10 }), "between").toEqual({
v: {
d: -10,
ad: 10,
d: -7,
ad: 7,
target: {
direction: "v",
beforeId: "a",
Expand All @@ -500,10 +500,10 @@ describe("newShapeIntervalSnapping", () => {
const target1 = newShapeIntervalSnapping({ shapeSnappingList: [shapeSnappingList[0], shapeSnappingList[2]] });

test("y snapping: should return snapping result", () => {
expect(target1.test({ x: 0, y: -70, width: 10, height: 10 }), "top side").toEqual({
expect(target1.test({ x: 0, y: -68, width: 10, height: 10 }), "top side").toEqual({
h: {
d: 10,
ad: 10,
d: 8,
ad: 8,
target: {
direction: "h",
beforeId: "a",
Expand All @@ -522,10 +522,10 @@ describe("newShapeIntervalSnapping", () => {
},
});

expect(target1.test({ x: 0, y: 310, width: 10, height: 10 }), "bottom side").toEqual({
expect(target1.test({ x: 0, y: 308, width: 10, height: 10 }), "bottom side").toEqual({
h: {
d: -10,
ad: 10,
d: -8,
ad: 8,
target: {
direction: "h",
beforeId: "a",
Expand All @@ -544,10 +544,10 @@ describe("newShapeIntervalSnapping", () => {
},
});

expect(target1.test({ x: 0, y: 110, width: 10, height: 10 }), "between").toEqual({
expect(target1.test({ x: 0, y: 112, width: 10, height: 10 }), "between").toEqual({
h: {
d: 10,
ad: 10,
d: 8,
ad: 8,
target: {
direction: "h",
beforeId: "a",
Expand All @@ -566,10 +566,10 @@ describe("newShapeIntervalSnapping", () => {
},
});

expect(target1.test({ x: 0, y: 130, width: 10, height: 10 }), "between").toEqual({
expect(target1.test({ x: 0, y: 126, width: 10, height: 10 }), "between").toEqual({
h: {
d: -10,
ad: 10,
d: -6,
ad: 6,
target: {
direction: "h",
beforeId: "a",
Expand Down

0 comments on commit 6b4da4a

Please sign in to comment.