improvement: Support numbers with commas in them (#2636)

This commit is contained in:
Christopher Chedeau 2020-12-20 04:08:22 -08:00 committed by GitHub
parent f14ae52e94
commit eb9e67e36a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 63 additions and 23 deletions

View file

@ -0,0 +1,20 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`tryParseSpreadsheet works for numbers with comma in them 1`] = `
Object {
"spreadsheet": Object {
"labels": Array [
"Week 1",
"Week 2",
"Week 3",
],
"title": "Users",
"values": Array [
814,
10301,
4264,
],
},
"type": "VALID_SPREADSHEET",
}
`;

13
src/tests/charts.test.tsx Normal file
View file

@ -0,0 +1,13 @@
import { tryParseSpreadsheet } from "../charts";
describe("tryParseSpreadsheet", () => {
it("works for numbers with comma in them", () => {
const result = tryParseSpreadsheet(
`Week Index${"\t"}Users
Week 1${"\t"}814
Week 2${"\t"}10,301
Week 3${"\t"}4,264`,
);
expect(result).toMatchSnapshot();
});
});