diff options
author | Patrick Quist <partouf@gmail.com> | 2022-01-04 15:58:44 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-04 15:58:44 +0000 |
commit | 99200468a3bc59c7e452b5a298f25ed566b51159 (patch) | |
tree | 93212a7ffb0466d4e5e69f9213d6398b80eb5ff4 /static/frontend-testing.ts | |
parent | fb9c718eed00b6c68bc53b006182457df5fb3833 (diff) | |
parent | 043c04fb96a7c14c993024d292a132f478ffbb00 (diff) | |
download | compiler-explorer-gh-1508.tar.gz compiler-explorer-gh-1508.zip |
Merge 043c04fb96a7c14c993024d292a132f478ffbb00 into fb9c718eed00b6c68bc53b006182457df5fb3833gh-1508
Diffstat (limited to 'static/frontend-testing.ts')
-rw-r--r-- | static/frontend-testing.ts | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/static/frontend-testing.ts b/static/frontend-testing.ts new file mode 100644 index 000000000..f11061957 --- /dev/null +++ b/static/frontend-testing.ts @@ -0,0 +1,30 @@ +import { ICEFrontendTesting, ICETestable } from './frontend-testing.interfaces'; + +class CEFrontendTesting implements ICEFrontendTesting { + private testSuites: Array<ICETestable>; + + constructor() { + this.testSuites = []; + } + + public add(test: ICETestable) { + this.testSuites.push(test); + } + + private findTest(name: string) { + for (const suite of this.testSuites) { + if (suite.description === name) { + return suite; + } + } + + throw new Error(`Can't find test ${name}`); + } + + public async run(testToRun: string) { + const testSuite = this.findTest(testToRun); + await testSuite.run(); + } +} + +window.frontendTesting = new CEFrontendTesting(); |