Skip to content

Instantly share code, notes, and snippets.

@suchy
Created September 20, 2023 23:31
Show Gist options
  • Save suchy/254d6ec8988635bce505839f0a136fa3 to your computer and use it in GitHub Desktop.
Save suchy/254d6ec8988635bce505839f0a136fa3 to your computer and use it in GitHub Desktop.
const { getColumnNumber } = require("./index");
test("A", () => {
expect(getColumnNumber("A")).toBe(0);
});
test("B", () => {
expect(getColumnNumber("B")).toBe(1);
});
test("Z", () => {
expect(getColumnNumber("Z")).toBe(25);
});
test("AA", () => {
expect(getColumnNumber("AA")).toBe(26);
});
test("AZ", () => {
expect(getColumnNumber("AZ")).toBe(51);
});
test("ZA", () => {
expect(getColumnNumber("ZA")).toBe(676);
});
test("ZZ", () => {
expect(getColumnNumber("ZZ")).toBe(701);
});
test("APN", () => {
expect(getColumnNumber("APN")).toBe(1105);
});
test("AAAA", () => {
expect(getColumnNumber("AAAA")).toBe(18278);
});
test("AZCA", () => {
expect(getColumnNumber("AZCA")).toBe(35230);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment