diff options
author | 2023-06-26 15:49:14 -0700 | |
---|---|---|
committer | 2023-06-26 15:49:26 -0700 | |
commit | a5100ad380f099907d4b3a9bec696f481b8e7821 (patch) | |
tree | 3a4f9c9320b19657b0d2b738ed791b4978bdbf20 /src | |
parent | 16598555f137112a3df2da5d8f2ee8edb496484f (diff) | |
download | bun-a5100ad380f099907d4b3a9bec696f481b8e7821.tar.gz bun-a5100ad380f099907d4b3a9bec696f481b8e7821.tar.zst bun-a5100ad380f099907d4b3a9bec696f481b8e7821.zip |
Fix .rejects
Diffstat (limited to 'src')
-rw-r--r-- | src/bun.js/test/expect.zig | 21 |
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; } |