mirror of
https://github.com/usebruno/bruno.git
synced 2026-06-23 12:45:38 +00:00
53 lines
1.4 KiB
Plaintext
53 lines
1.4 KiB
Plaintext
meta {
|
|
name: getCookies
|
|
type: http
|
|
seq: 3
|
|
}
|
|
|
|
get {
|
|
url: {{host}}/ping
|
|
body: none
|
|
auth: inherit
|
|
}
|
|
|
|
tests {
|
|
const jar = bru.cookies.jar()
|
|
|
|
jar.getCookies("https://testbench-sanity.usebruno.com", function(error, data) {
|
|
if(error) {
|
|
console.error("Cookies retrieval error:", error)
|
|
throw new Error(`Failed to get cookies: ${error.message || error}`)
|
|
}
|
|
|
|
test("should successfully retrieve cookies array", function() {
|
|
expect(error).to.be.null;
|
|
expect(data).to.not.be.null;
|
|
expect(data).to.be.an('array');
|
|
console.log("Retrieved cookies count:", data.length);
|
|
});
|
|
|
|
test("should have valid cookie structure in array", function() {
|
|
data.forEach((cookie, index) => {
|
|
expect(cookie).to.have.property('key');
|
|
expect(cookie).to.have.property('value');
|
|
expect(cookie.key).to.be.a('string');
|
|
expect(cookie.value).to.be.a('string');
|
|
expect(cookie.domain).to.include('usebruno.com');
|
|
console.log(`Cookie ${index + 1}:`, cookie);
|
|
});
|
|
});
|
|
|
|
test("should contain expected cookie properties", function() {
|
|
const cookieKeys = data.map(cookie => cookie.key);
|
|
expect(cookieKeys).to.be.an('array');
|
|
console.log("Found cookie keys:", cookieKeys);
|
|
});
|
|
})
|
|
|
|
jar.clear()
|
|
}
|
|
|
|
settings {
|
|
encodeUrl: true
|
|
}
|