aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-06-26 15:49:14 -0700
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-06-26 15:49:26 -0700
commita5100ad380f099907d4b3a9bec696f481b8e7821 (patch)
tree3a4f9c9320b19657b0d2b738ed791b4978bdbf20 /src
parent16598555f137112a3df2da5d8f2ee8edb496484f (diff)
downloadbun-a5100ad380f099907d4b3a9bec696f481b8e7821.tar.gz
bun-a5100ad380f099907d4b3a9bec696f481b8e7821.tar.zst
bun-a5100ad380f099907d4b3a9bec696f481b8e7821.zip
Fix .rejects
Diffstat (limited to 'src')
-rw-r--r--src/bun.js/test/expect.zig21
1 files changed, 7 insertions, 14 deletions
diff --git a/src/bun.js/test/expect.zig b/src/bun.js/test/expect.zig
index 90fcb2a73..e0833f8ed 100644
--- a/src/bun.js/test/expect.zig
+++ b/src/bun.js/test/expect.zig
@@ -73,32 +73,25 @@ pub const Expect = struct {
}
pub fn getResolves(this: *Expect, thisValue: JSValue, globalThis: *JSGlobalObject) callconv(.C) JSValue {
- switch (this.flags.promise) {
+ this.flags.promise = switch (this.flags.promise) {
+ .resolves, .none => .resolves,
.rejects => {
globalThis.throw("Cannot chain .resolves() after .rejects()", .{});
return .zero;
},
- .resolves => {},
- .none => {
- this.flags.promise = .resolves;
- },
- }
+ };
+
return thisValue;
}
pub fn getRejects(this: *Expect, thisValue: JSValue, globalThis: *JSGlobalObject) callconv(.C) JSValue {
- switch (this.flags.promise) {
- .rejects => {
- this.flags.promise = .rejects;
- },
+ this.flags.promise = switch (this.flags.promise) {
+ .none, .rejects => .rejects,
.resolves => {
globalThis.throw("Cannot chain .rejects() after .resolves()", .{});
return .zero;
},
- .none => {
- this.flags.promise = .resolves;
- },
- }
+ };
return thisValue;
}