Skip to content

Commit

Permalink
test: move all relevant tests to the transform test file
Browse files Browse the repository at this point in the history
  • Loading branch information
mertcanaltin committed Aug 12, 2024
1 parent 7ab707d commit 1af04e4
Show file tree
Hide file tree
Showing 6 changed files with 207 additions and 231 deletions.
7 changes: 0 additions & 7 deletions test/snapshots/transform-decorator-namespace.test.js.snapshot

This file was deleted.

11 changes: 0 additions & 11 deletions test/snapshots/transform-feature.test.js.snapshot

This file was deleted.

20 changes: 20 additions & 0 deletions test/snapshots/transform.test.js.snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,23 @@ exports[`should perform transformation without source maps 1`] = `
exports[`should perform transformation without source maps and filename 1`] = `
"var Foo;\\n(function(Foo) {\\n Foo[Foo[\\"Bar\\"] = 7] = \\"Bar\\";\\n Foo[Foo[\\"Baz\\"] = 2] = \\"Baz\\";\\n})(Foo || (Foo = {}));\\nx = 7;\\n"
`;

exports[`should transform TypeScript class decorators with multiple decorators 1`] = `
"@sealed\\n@log\\nclass BugReport {\\n type = \\"report\\";\\n title;\\n constructor(t){\\n this.title = t;\\n }\\n}\\nfunction sealed(constructor) {\\n Object.seal(constructor);\\n Object.seal(constructor.prototype);\\n}\\nfunction log(constructor) {\\n console.log(\\"Creating instance of\\", constructor.name);\\n}\\nconst report = new BugReport(\\"Test\\");\\n"
`;

exports[`should transform TypeScript class fields 1`] = `
"class Counter {\\n count = 0;\\n increment() {\\n this.count++;\\n }\\n}\\n"
`;

exports[`should transform TypeScript namespaces with additional functionality 1`] = `
"var Validation;\\n(function(Validation) {\\n const lettersRegexp = /^[A-Za-z]+$/;\\n class LettersOnlyValidator {\\n isAcceptable(s) {\\n return lettersRegexp.test(s);\\n }\\n static createValidator() {\\n return new LettersOnlyValidator();\\n }\\n }\\n Validation.LettersOnlyValidator = LettersOnlyValidator;\\n})(Validation || (Validation = {}));\\nconst validator = Validation.LettersOnlyValidator.createValidator();\\nconst isValid = validator.isAcceptable(\\"test\\");\\n// Exporting these for VM context\\nglobalThis.validator = validator;\\nglobalThis.isValid = isValid;\\n"
`;

exports[`should transform TypeScript private class fields 1`] = `
"class Counter {\\n #count = 0;\\n increment() {\\n this.#count++;\\n }\\n getCount() {\\n return this.#count;\\n }\\n}\\n"
`;

exports[`should transform TypeScript type annotations and type guards 1`] = `
"function isString(value) {\\n return typeof value === 'string';\\n}\\n"
`;
106 changes: 0 additions & 106 deletions test/transform-decorator-namespace.test.js

This file was deleted.

107 changes: 0 additions & 107 deletions test/transform-feature.test.js

This file was deleted.

Loading

0 comments on commit 1af04e4

Please sign in to comment.