Backstage
    Preparing search index...

    Test utility for Backstage Search collators, decorators, and indexers.

    An example test checking that a collator provides expected documents.

    it('provides expected documents', async () => {
    const testSubject = await yourCollatorFactory.getCollator();
    const pipeline = TestPipeline.fromCollator(testSubject);

    const { documents } = await pipeline.execute();

    expect(documents).toHaveLength(2);
    })

    An example test checking that a decorator behaves as expected.

    it('filters private documents', async () => {
    const testSubject = await yourDecoratorFactory.getDecorator();
    const pipeline = TestPipeline
    .fromDecorator(testSubject)
    .withDocuments([{ title: 'Private', location: '/private', text: '' }]);

    const { documents } = await pipeline.execute();

    expect(documents).toHaveLength(0);
    })
    Index

    Methods