aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
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;
}