I’m just getting started with testing, and I tried...
# help
j
I’m just getting started with testing, and I tried defining a very minimal test:
Copy code
test("Test Stack", () => {
  const app = new <http://sst.App|sst.App>();

  const stack = new PeopleEnrichmentStack(app, "test-stack");

  expect(stack).to(haveResource("AWS::SQS"));
});
, but I’m getting
Copy code
Cannot find a handler file at src/people_data_enrichment/handlers/people_data_enricher.js".
which seems to be related to the test expecting a
.js
file when it really should be
.py
since I’m using python. Any thoughts?
f
hmm… can you share a snippet of the PeopleEnrichmentStack stack?
j
sure
Copy code
export default class PeopleDataEnrichmentStack extends sst.Stack {
  constructor(scope, id, props) {
    super(scope, id, props);

    const queue = new sst.Queue(this, "people-data-enrichment", {
      consumer: {
        function: {
          handler: "handlers/people_data_enricher.handler",
          srcPath: "src/people_data_enrichment",
        },
        consumerProps: {
          batchSize: 1,
        },
      },
    });

    const topic = new sst.Topic(this, "user-events", {
      defaultFunctionProps: {
        srcPath: "src/people_data_enrichment",
      },
      subscribers: [queue],
    });

    const api = new sst.Api(this, "Api", {
      routes: {
        "POST /": {
          function: {
            srcPath: "src/people_data_enrichment",
            handler: "handlers/sns_publisher.handler",
            environment: {
              USER_EVENTS_TOPIC_ARN: topic.topicArn,
              FULLCONTACT_API_KEY: process.env.FULLCONTACT_API_KEY,
            },
            permissions: [topic],
          },
        },
      },
    });

    this.addOutputs({
      ApiEndpoint: api.url,
      TopicName: topic.topicArn,
    });
  }
}
f
Are you setting the runtime anywhere? Default runtime is NodeJS
j
hmm not really — I assume this should be a param of the function props, right?
I’m setting this in index.js:
Copy code
app.setDefaultFunctionProps({
    runtime: "python3.8",
  });
f
You’d need to do that in ur test too
Your test is creating a new
app
construct:
Copy code
const app = new <http://sst.App|sst.App>();
j
🤦‍♂️ ofc, good catch!