toMatchPdfSnapshot()

in src/toMatchPdfSnapshot.ts [22:35]


    toMatchPdfSnapshot(pdf: string | Buffer, opts?: Partial<CompareImagesOpts>) {
      const { isNot, testPath, currentTestName } = this
      if (isNot) {
        throw new Error('Jest: `.not` cannot be used with `.toMatchPdfSnapshot()`.')
      }

      const currentDirectory = dirname(testPath)
      const snapshotName = currentTestName.split(' ').join('_')

      return comparePdfToSnapshot(pdf, currentDirectory, snapshotName, opts).then((pass) => ({
        pass,
        message: () => 'Does not match with snapshot.',
      }))
    },