Skip to content

Commit

Permalink
fix: bring back examples test
Browse files Browse the repository at this point in the history
+ ignore device motion examples
  • Loading branch information
felixroos committed Jan 31, 2025
1 parent 5cef1a8 commit 75f5f45
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions test/examples.test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { queryCode } from './runtime.mjs';
import { describe, it } from 'vitest';
import doc from '../doc.json';

const skippedExamples = [
'absoluteOrientationGamma',
'absoluteOrientationBeta',
'absoluteOrientationAlpha',
'orientationGamma',
'orientationBeta',
'orientationAlpha',
'rotationGamma',
'rotationBeta',
'rotationAlpha',
'gravityZ',
'gravityY',
'gravityX',
'accelerationZ',
'accelerationY',
'accelerationX',
];

describe('runs examples', () => {
const { docs } = doc;
docs.forEach(async (doc) => {
if (skippedExamples.includes(doc.name)) {
return;
}
doc.examples?.forEach((example, i) => {
it(`example "${doc.name}" example index ${i}`, async ({ expect }) => {
const haps = await queryCode(example, 4);
expect(haps).toMatchSnapshot();
});
});
});
});

0 comments on commit 75f5f45

Please sign in to comment.