Migrate test inits from Promise to Effect (#25377)

This commit is contained in:
Kit Langton
2026-05-02 09:07:59 -04:00
committed by GitHub
parent becf57ee6a
commit d99dde6306
6 changed files with 199 additions and 160 deletions

View File

@@ -45,10 +45,10 @@ test("Bedrock: config region takes precedence over AWS_REGION env var", async ()
})
await Instance.provide({
directory: tmp.path,
init: async () => {
init: Effect.promise(async () => {
set("AWS_REGION", "us-east-1")
set("AWS_PROFILE", "default")
},
}).pipe(Effect.asVoid),
fn: async () => {
const providers = await list()
expect(providers[ProviderID.amazonBedrock]).toBeDefined()
@@ -70,10 +70,10 @@ test("Bedrock: falls back to AWS_REGION env var when no config region", async ()
})
await Instance.provide({
directory: tmp.path,
init: async () => {
init: Effect.promise(async () => {
set("AWS_REGION", "eu-west-1")
set("AWS_PROFILE", "default")
},
}).pipe(Effect.asVoid),
fn: async () => {
const providers = await list()
expect(providers[ProviderID.amazonBedrock]).toBeDefined()
@@ -125,11 +125,11 @@ test("Bedrock: loads when bearer token from auth.json is present", async () => {
await Instance.provide({
directory: tmp.path,
init: async () => {
init: Effect.promise(async () => {
set("AWS_PROFILE", "")
set("AWS_ACCESS_KEY_ID", "")
set("AWS_BEARER_TOKEN_BEDROCK", "")
},
}).pipe(Effect.asVoid),
fn: async () => {
const providers = await list()
expect(providers[ProviderID.amazonBedrock]).toBeDefined()
@@ -171,10 +171,10 @@ test("Bedrock: config profile takes precedence over AWS_PROFILE env var", async
})
await Instance.provide({
directory: tmp.path,
init: async () => {
init: Effect.promise(async () => {
set("AWS_PROFILE", "default")
set("AWS_ACCESS_KEY_ID", "test-key-id")
},
}).pipe(Effect.asVoid),
fn: async () => {
const providers = await list()
expect(providers[ProviderID.amazonBedrock]).toBeDefined()
@@ -203,9 +203,9 @@ test("Bedrock: includes custom endpoint in options when specified", async () =>
})
await Instance.provide({
directory: tmp.path,
init: async () => {
init: Effect.promise(async () => {
set("AWS_PROFILE", "default")
},
}).pipe(Effect.asVoid),
fn: async () => {
const providers = await list()
expect(providers[ProviderID.amazonBedrock]).toBeDefined()
@@ -236,12 +236,12 @@ test("Bedrock: autoloads when AWS_WEB_IDENTITY_TOKEN_FILE is present", async ()
})
await Instance.provide({
directory: tmp.path,
init: async () => {
init: Effect.promise(async () => {
set("AWS_WEB_IDENTITY_TOKEN_FILE", "/var/run/secrets/eks.amazonaws.com/serviceaccount/token")
set("AWS_ROLE_ARN", "arn:aws:iam::123456789012:role/my-eks-role")
set("AWS_PROFILE", "")
set("AWS_ACCESS_KEY_ID", "")
},
}).pipe(Effect.asVoid),
fn: async () => {
const providers = await list()
expect(providers[ProviderID.amazonBedrock]).toBeDefined()
@@ -279,9 +279,9 @@ test("Bedrock: model with us. prefix should not be double-prefixed", async () =>
})
await Instance.provide({
directory: tmp.path,
init: async () => {
init: Effect.promise(async () => {
set("AWS_PROFILE", "default")
},
}).pipe(Effect.asVoid),
fn: async () => {
const providers = await list()
expect(providers[ProviderID.amazonBedrock]).toBeDefined()
@@ -316,9 +316,9 @@ test("Bedrock: model with global. prefix should not be prefixed", async () => {
})
await Instance.provide({
directory: tmp.path,
init: async () => {
init: Effect.promise(async () => {
set("AWS_PROFILE", "default")
},
}).pipe(Effect.asVoid),
fn: async () => {
const providers = await list()
expect(providers[ProviderID.amazonBedrock]).toBeDefined()
@@ -352,9 +352,9 @@ test("Bedrock: model with eu. prefix should not be double-prefixed", async () =>
})
await Instance.provide({
directory: tmp.path,
init: async () => {
init: Effect.promise(async () => {
set("AWS_PROFILE", "default")
},
}).pipe(Effect.asVoid),
fn: async () => {
const providers = await list()
expect(providers[ProviderID.amazonBedrock]).toBeDefined()
@@ -388,9 +388,9 @@ test("Bedrock: model without prefix in US region should get us. prefix added", a
})
await Instance.provide({
directory: tmp.path,
init: async () => {
init: Effect.promise(async () => {
set("AWS_PROFILE", "default")
},
}).pipe(Effect.asVoid),
fn: async () => {
const providers = await list()
expect(providers[ProviderID.amazonBedrock]).toBeDefined()