Skip to content

Commit

Permalink
test for script escape
Browse files Browse the repository at this point in the history
  • Loading branch information
charredUtensil committed Jul 3, 2024
1 parent db39c0d commit 7cbab5b
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/core/architects/utils/script.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { escapeString } from "./script";

describe('escapeString', () => {
it('handles the empty string', () => {
expect(escapeString('')).toBe('');
});
it('handles a normal string', () => {
expect(escapeString('A landslide has occurred!')).toBe('A landslide has occurred!');
});
it('escapes quotes', () => {
expect(escapeString('An "Energy Crystal" has been found!')).toBe('An \\"Energy Crystal\\" has been found!');
});
it('removes backslashes', () => {
expect(escapeString('\\n\\n\\n\\')).toBe('nnn');
});
});

0 comments on commit 7cbab5b

Please sign in to comment.